From fe3fb9c07d5280995e20f0ee4071fea58643b667 Mon Sep 17 00:00:00 2001 From: ccnuktd <70876754+ccnuktd@users.noreply.github.com> Date: Tue, 14 Dec 2021 11:34:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8B=98=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- basic_content/sizeof/README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/basic_content/sizeof/README.md b/basic_content/sizeof/README.md index 7cfdbc0..afdadc1 100644 --- a/basic_content/sizeof/README.md +++ b/basic_content/sizeof/README.md @@ -119,6 +119,17 @@ class A * long b * 根据字节对齐4+4=8+8+8=24 */ + +/** + * 非作者本人 + * char a + * int b + * short a + * long b + * 在32位机器底下,根据字节对齐应该为char = 1(对齐后为4),int = 4,short = 2(对齐后为4),long = 4 + * 总和应该为16 + */ + class B:A { public: