Attention is currently required from: fixeria.
Patch set 1:Code-Review +1
1 comment:
Patchset:
oh. Actually in API functions it is fine for padding bytes to be returned random.
I thought we were chatting about regression test functions only, my bad, I probably didn't look closely enough.
So the nicest solution IMHO is to use memset(0) in the *regression tests* only, before feeding the struct pointers to the API functions... because only the regression tests even care about the padding bytes.
except if you are saying, a struct that has been memset(0) has its padding bytes overwritten randomly by *foo = (struct foo){} ... in my world so far that does not happen, but if zero padding does not stay zero, that would be a reason to memset(0) in the API implementation too, and that would change how I understand struct initialization.
Anyway, it's not really critical.
I just find memset(0) looks ugly, and regression tests are allowed to look ugly, API implementations not so much.
Also, theoretically, a type's constructor doesn't necessarily mean to initialize with zero; nonzero constructors happen a lot in C++ -- but in all practicality in our C code it means exactly zero. So it's academic nitpick, and just my personal taste...
To view, visit change 31505. To unsubscribe, or for help writing mail filters, visit settings.