2 ms·
The padding has unspecified values, which is distinct from being uninitialised. If it were otherwise, you couldn't `memcpy()` structures around.
by caf 8y ago
The padding has unspecified values, which is distinct from being uninitialised.
If it were otherwise, you couldn't `memcpy()` structures around.
- loup-vaillant 8y agoI believe there's an exception for the likes of `memcpy()`. Something along the lines of "type punning and reading indeterminate values is undefined except when we're reading through a `char*` or something. I'll check the unbelievably thick book that tries to specify C11 (I've printed it, it's over 2 pounds).
- caf 8y agoThe only way to access the padding without otherwise falling into undefined behaviour is by using a char * anyway (including indirectly using a char *, through memcpy()).