3 ms·
Ugh, what do you do when the structure definition is updated and you now have uninitialized values? If there's no explicit initializer I think memset,calloc or
by swiley 8y ago
Ugh, what do you do when the structure definition is updated and you now have uninitialized values?
If there's no explicit initializer I think memset,calloc or ={0} is just fine thanks.
- hazeii 8y agoUnclear to me why you've been downvoted; I've seen many cases where a structure has had elements added which would be end up uninitialised. A memset(&struct,0,sizeof(struct)) seems pretty reasonable to me.
- NikkiA 8y agoProbably because the article specifically addresses this issue and C99 specifically initializes any members who are not named in the initializer form to either zero or NULL.