How to specify 64 bit integers in c

后端 未结 5 1934
予麋鹿
予麋鹿 2020-12-07 23:58

I\'m trying to use 64 bit integers in C, but am getting mixed signals as to whether it should be possible.

When I execute the printf:

printf(\"Size o         


        
5条回答
  •  时光取名叫无心
    2020-12-08 00:47

    Try an LL suffix on the number, the compiler may be casting it to an intermediate type as part of the parse. See http://gcc.gnu.org/onlinedocs/gcc/Long-Long.html

    long long int i2 = 0x0000444400004444LL;

    Additionally, the the compiler is discarding the leading zeros, so 0x000044440000 is becoming 0x44440000, which is a perfectly acceptable 32-bit integer (which is why you aren't seeing any warnings prior to f2).

提交回复
热议问题