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...
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/31505
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ib16964b16eb04315efc416164ed46c15b5dc7254
Gerrit-Change-Number: 31505
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: neels <[email protected]>
Gerrit-Attention: fixeria <[email protected]>
Gerrit-Comment-Date: Sat, 25 Feb 2023 01:24:14 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment