|
|
|
|
|
by kurtreed
1286 days ago
|
|
bool are_equal = memcmp(&a, &b, sizeof(some_struct_t));
Isn't this a bug? Structs are allowed to have padding bytes between bytes occupied by fields, which will have unpredictable ("garbage") values. So a pair of structs with all fields pairwise same can have different padding bytes, so checking equality with this method will give a false negative. |
|