mirror of
https://github.com/Karaka-Management/Developer-Guide.git
synced 2026-01-11 04:18:43 +00:00
Update cpp.md
Signed-off-by: Dennis Eichhorn <spl1nes.com@googlemail.com>
This commit is contained in:
parent
b981bc2921
commit
25a866c821
|
|
@ -27,6 +27,22 @@ 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++
|
||||
struct Bad {
|
||||
bool a;
|
||||
int b;
|
||||
bool c;
|
||||
};
|
||||
```
|
||||
|
||||
```c++
|
||||
struct Good {
|
||||
int b;
|
||||
bool a;
|
||||
bool c;
|
||||
};
|
||||
```
|
||||
|
||||
## Templates
|
||||
|
||||
Don't use C++ templates.
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user