On Fri, Feb 19, 2016 at 04:50:40PM -0800, Conrad Meyer wrote: C> > It is not quite as simple as this would make it sound. The elements or C> > members of an aggregate (e.g.) structure type are initialized as if it were C> > an object of static storage duration (i.e., to zero) if the initializer list C> > does not contain enough initializers for all members of the aggregate type, C> > per item 21 of section 6.7.8 of n1256.pdf. However, such initialization C> > does not necessarily need to zero any padding bytes that are present, which C> > may take unspecified values. Personally, I think this particular clang C> > warning can be too aggressive, especially for complex structs, but on the C> > other hand given the indeterminateness of padding, bzero/memset are often a C> > better choice anyway. C> C> By definition, padding byte contents are unused. There is no reason C> their values matter one way or another, so why do we care about the C> distinction between bzero and member zero initialization?
Well, one can run bcmp() or a hashing function over entire structure, in that case contents of padding matter. But I still don't want to see this warning in -Wall, since it kills very useful C99 initializers. The code, that runs bcmp() or hashes over structs, should take care, and we shouldn't pessimize the entire build for its sake. -- Totus tuus, Glebius. _______________________________________________ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"