Update cpp.md

Signed-off-by: Dennis Eichhorn <spl1nes.com@googlemail.com>
This commit is contained in:
Dennis Eichhorn 2024-07-28 03:21:39 +02:00 committed by GitHub
parent 25a866c821
commit 35c1c1536c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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;