C enum的bump

张开发
2026/4/10 10:22:14 15 分钟阅读

分享文章

C enum的bump
C and some implementations of C permit enums larger than an int. The underlying type is bumped to an unsigned int, long int or unsigned long int, in that order.AMD64 ABI Draft 1.0 – January 28, 2018 – 8:23[rootVMTCA test]#./a.outsizeofabc8sizeofabc14[rootVMTCA test]# catenum.c#includestdio.henumabc{AB10000000000000000,};enumabc1{AB11000000000};intmain(){printf(sizeof abc %d\n,sizeof(enumabc));printf(sizeof abc1 %d\n,sizeof(enumabc1));return0;}

更多文章