很有意义的const类型

很有意义的const类型

很有意思的const类型
很有意义的const类型

#include <stdio.h>
int main()
{
const int a = 0x12345678;
int* p = const_cast<int*>(&a);
*p = 11;

printf("a=%d\n", *((&a+1)-1));
printf("a=%d\n", *(&a));
int c = a;
printf("c=%d\n", c);
return 0;
}

------解决方案--------------------
const folding
------解决方案--------------------
如楼上那一网页的英文。实际vs反汇编截图:
很有意义的const类型
虽然访问数据地址一样,但是push数值不同!