Unexpected sign extension of int32 or 32bit pointer when converted to uint64

前端 未结 4 2017
醉话见心
醉话见心 2020-12-19 19:50

I compiled this code using Visual Studio 2010 (cl.exe /W4) as a C file:

int main( int argc, char *argv[] )
{
    unsigned __int64 a = 0x00000000         


        
4条回答
  •  时光取名叫无心
    2020-12-19 20:45

    From the C99 standard (§6.3.2.3/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.

    So you'll need to find your compiler's documentation that talks about that.

提交回复
热议问题