From 35c1c1536c0a306f10860d017922147901da8111 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sun, 28 Jul 2024 03:21:39 +0200 Subject: [PATCH] Update cpp.md Signed-off-by: Dennis Eichhorn --- standards/cpp.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/standards/cpp.md b/standards/cpp.md index 5aeda95..fa13dc7 100755 --- a/standards/cpp.md +++ b/standards/cpp.md @@ -28,6 +28,7 @@ Be careful when you use unsigned and signed integers. When using unsigned intege Make sure structs don't have too much overhead due to alignment padding. Re-ordering struct members can fix a lot of padding overhead. ```c++ +// sizeof == 12 struct Bad { bool a; int b; @@ -36,6 +37,7 @@ struct Bad { ``` ```c++ +// sizeof == 8 struct Good { int b; bool a;