我發現在C以下語法++源文件(沒有標頭):不太得到的是:uintptr_t的值(astruct.val)
template <typename Type_> static void aFunction(Type_ &function, ...) {
uintptr_t value(astruct.val); //confusing
}
是,有關的價值宣言混亂線?我試着寫像一個Hello World程序:
int main(){ uintptr_t a(80); return 0;}
,並返回數字常量之前預期的聲明說明符或「...」,可我知道那有什麼困惑行嗎?謝謝!
編輯:我想我應該展示完整的函數聲明:
template <typename Type_>
static void nlset(Type_ &function, struct nlist *nl, size_t index) {
struct nlist &name(nl[index]);
uintptr_t value(name.n_value);// this is the confusing line
if ((name.n_desc & N_ARM_THUMB_DEF) != 0)
value |= 0x00000001;
function = reinterpret_cast<Type_>(value);
}
錯誤是什麼? 「astruct」從哪裏來的?它的類型是什麼? – 2012-02-27 10:22:25
你期望會發生什麼?你的代碼會打印你好世界? – CashCow 2012-02-27 10:23:05
'uintptr_t'被定義爲一個無符號整數,保證它與指針具有相同的大小。你忘了包含''(C++ 03)嗎? –
Zeta
2012-02-27 10:27:24