Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> writes: > Any language which allows you to write > > strnlen(0, NULL); > > without screaming about getting the types entirely wrong for both > arguments is simply not worth using. We got over the old K&R C > braindamage long ago. I totally get that and I agree with you on this. I was talking specifically about struct initializer (cf thread subject). In my mind {0} is the idiomatic and standard way of initiliazing a struct to zeroes, regardless of the number or type of the fields it has. In fact if you google "how to initialize struct to zero" you'll only find {0} or memset() (and not {}). I'm actually surprised to see that {} has more occurences in Linux code despite it being non-standard (in C89, C99 and C11 but valid in C++). Basically I don't see it as "initialize the first field to the int zero and leave the rest of the fields as the default value which happens to be zero as well" but as the idiomatic "initialize the struct to zeroes" and so I was surprised to see it emits a warning. I also think all other uses of 0 as NULL should definitely emit a warning as you pointed out. Now I understand google results and stackoverflow are not authoritative sources, or that the standard might not have made the best decisions or that a special case "don't emit warning if it matches the single-zero-initializer for a struct" like that might be dumb. Just expressing my opinion, again feel free to ignore if this is noise. Cheers, -- Aurélien Aptel / SUSE Labs Samba Team GPG: 1839 CB5F 9F5B FB9B AA97 8C99 03C8 A49B 521B D5D3 SUSE Linux GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg)