看板 C_and_CPP 關於我們 聯絡資訊
GNUGCC:那就換您說說看您的觀點如何? 08/27 23:00
Feis:哪個觀點? 我都說了指標不等同無號正整數大概有數十次~ 08/27 23:05
Feis:然後我發現你對"無號正整數"有些跟我不一樣的認知 08/27 23:08
Feis:所以我才跟你討論這個~ 08/27 23:08
GNUGCC:那請問「指標不等同無號正整數」的觀點為何? 08/27 23:16
各位看官請慢慢看... 不過 C++ 小弟就不知道惹,沒翻過 Cpp standard (逃 N1570 Committee Draft — April 12, 2011 ISO/IEC 9899:201xOB 6.3.2.3 Pointers 5. An integer may be converted to any pointer type. Except as previously specified, the result is implementation-defined, might not be correctly aligned, might not point to an entity of the referenced type, and might be a trap representation.(67) 6. Any pointer type may be converted to an integer type. Except as previously specified, the result is implementation-defined. If the result cannot be represented in the integer type, the behavior is undefined. The result need not be in the range of values of any integer type. (67) The mapping functions for converting a pointer to an integer or an integer to a pointer are intended to be consistent with the addressing structure of the execution environment. 6.5.4 Cast operators 4. A pointer type shall not be converted to any floating type. A floating type shall not be converted to any pointer type. -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 72.36.94.170