Attention is currently required from: laforge.
2 comments:
File src/osmo-hnbgw/hnbgw_cn.c:
Patch Set #2, Line 570: hsi = talloc(cnlink, struct hnbgw_sccp_inst);
no zero-initialization
full init of all members follows right in the next line.
Based on my understanding, the compiler is permitted to only set those member fields explicitly stat […]
i've been using the idiom of
*foo = (struct foo){
.something = 123,
};
as a way to reliably initialize all members of foo with zero a lot, for a long long time now. If that is wrong then we may have a bit of a problem...
For example in osmo-bsc, in lchan_reset(), i use above idiom to clear out all stale lchan state. It works. But is that just incidental?
We have discussed this idiom a lot on and off, and I am actually pretty sure it is defined to zero-initialize all members. It does/may not initialize the padding, but i almost never care about that, only when going to use memcmp(). Also we discussed 'foo = {}' vs 'foo = {0}', but so far each time I end up being right on that topic. I think Pau or was it Vadim had an interesting link on a discussion among C language developers?
anyhow, I accept your premature-optimization argument, and I want to get this merged as quickly as possible to help out a customer.
(Still I am quite certain that I'm right with that way of initialization.)
To view, visit change 32323. To unsubscribe, or for help writing mail filters, visit settings.