编译器会强制没有数据成员的对象长度非零

C++语言: Codee#2574201#include

02#include

03usingnamespacestd;

04

05classNotEmpty

06{

07

08};

09

10intmain()

11{

12cout<<sizeof(NotEmpty)<<endl;

13return0;

14}

15

16/

171

18

19Process returned 0 (0x0) execution time : 0.027 s

20Press any key to continue.

21

22

23
/原文链接: https://www.cnblogs.com/invisible/archive/2012/03/08/2384661.html

欢迎关注

微信关注下方公众号,第一时间获取干货硬货;公众号内回复【pdf】免费获取数百本计算机经典书籍

原创文章受到原创版权保护。转载请注明出处:https://www.ccppcoding.com/archives/43690

非原创文章文中已经注明原地址,如有侵权,联系删除

关注公众号【高性能架构探索】,第一时间获取最新文章

转载文章受原作者版权保护。转载请注明原作者出处!

(0)
上一篇 2023年2月8日 下午8:19
下一篇 2023年2月8日 下午8:19

相关推荐