|
|
|
|
|
by veyh
1086 days ago
|
|
You can have memset/memcmp work for individual structs by setting the padding yourself, and to make sure you do it right, on GCC/clang you can use -Wpadded. It's probably best to do that on a case-by-case basis, unless you're prepared to deal with a lot of compiler warnings/errors though. #pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wpadded"
struct foo {
uint8_t a;
uint8_t _pad[3];
uint32_t b;
};
#pragma GCC diagnostic pop
|
|