mirror of
https://github.com/Karaka-Management/Developer-Guide.git
synced 2026-02-11 01:48:39 +00:00
Update cpp.md
Signed-off-by: Dennis Eichhorn <spl1nes.com@googlemail.com>
This commit is contained in:
parent
25a866c821
commit
35c1c1536c
|
|
@ -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.
|
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++
|
```c++
|
||||||
|
// sizeof == 12
|
||||||
struct Bad {
|
struct Bad {
|
||||||
bool a;
|
bool a;
|
||||||
int b;
|
int b;
|
||||||
|
|
@ -36,6 +37,7 @@ struct Bad {
|
||||||
```
|
```
|
||||||
|
|
||||||
```c++
|
```c++
|
||||||
|
// sizeof == 8
|
||||||
struct Good {
|
struct Good {
|
||||||
int b;
|
int b;
|
||||||
bool a;
|
bool a;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user