Attention is currently required from: fixeria.
neels has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/31505 )
Change subject: gsm/{bsslap,bssmap_le}: zero-initialize structs using memset() ......................................................................
Patch Set 1: Code-Review+1
(1 comment)
Patchset:
PS1: 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...