C++类对象的内存布局

好文, 与当年我看《深度探索c++对象模型》时的困惑一样,当时看的也是云里雾里。

https://blog.csdn.net/shichao1470/article/details/91563282

有一点要说明一下, 现在最新的g++编译器,dump出c++类对象内存布局的编译选项,应该变为:
-fdump-lang-class, 而不是链接中的 -fdump-class-hierarchy选项, 最起码在我电脑上是这样的, 查看了在最新的gcc官方手册上, 也是这样的, 说明如下:

-fdump-lang-all
-fdump-lang-switch
-fdump-lang-switch-options
-fdump-lang-switch-options=filename
Control the dumping of language-specific information. The options and filename portions behave as described in the ‘-fdump-tree’ option. The following
switch values are accepted:
‘all’
Enable all language-specific dumps.
‘class’ Dump class hierarchy information. Virtual table information is
emitted unless ’‘slim’’ is specified. This option is applicable to
C++ only.
‘raw’ Dump the raw internal tree data. This option is applicable to C++
only.

posted @ 2021-05-28 23:29  殷大侠  阅读(225)  评论(0编辑  收藏  举报