-1
我想了解以下两个定义我们可以指定一个unsigned int类型varaible,0xFULL文字
unsigned long long id = 0x0FULL; //should be correct
unsigned int store = 0X0FULL; // ?? Can this be done
printf("id is : 0x%llx store is : 0x%x\n",id,store);
的两个变量的输出返回相同的值
id is : 0xf store is : 0xf
你的意思是15十进制吧? 另外,我得到的0xFULL是一个'ULL'文字,所以你的意思是做错事会做点像 'unsigned int store = 0X0FULL;' – cmidi 2015-02-09 16:51:39
@cmidi我的意思是十进制15,用十六进制表示。我看到我有点混淆起来。 'unsigned int store = 0x0FULL;'有效但很奇怪。这是有效的,因为任何两个整型类型之间存在隐式转换,包括从'unsigned long long'到'unsigned int'。这很奇怪,因为如果你想要一个'unsigned int',你为什么要用'ULL'后缀? – hvd 2015-02-09 16:55:35
我只是想在一个开源的库代码中寻找一个问题,它在代码中有类似的地方 – cmidi 2015-02-09 17:03:54