On Mon, 18 Feb 2013 22:40:23 +0000, Pete Batard said: >> You should have a value for _each_ field to initialize. >> >> A correct patch is something like: >> - SP_DEVINFO_DATA dev_info_data = { 0 }; >> + SP_DEVINFO_DATA dev_info_data = { 0, {0, 0, 0, {0, 0, 0, 0, 0, 0, >> 0, 0}}, 0, 0 }; > >I'm well aware of this. My point was that, in 2013, a compiler that >forces a programmer to waste time setting each and every individual >fields of a struct to zero, or add a memset line, really needs to be >brought up to speed. How much time did you have to spend to figure out >the number of zeroes and where to put the brackets? Unless there's a >specific value in there that should be nonzero, that's a pure waste of time.
"= { 0 }" _will_ init all fields to zero: C99 Standard 6.7.8.21 : "If there are fewer initializers in a brace-enclosed list than there are elements or members of an aggregate, or fewer characters in a string literal used to initialize an array of known size than there are elements in the array, the remainder of the aggregate shall be initialized implicitly the same as objects that have static storage duration." gcc's -Wmissing-field-initializers is overly noisy; good discussion here: <http://stackoverflow.com/questions/1538943/why-is-the-compiler-throwing-this-warning-missing-initializer-isnt-the-stru> Cheers, -- ____________________________________________________________ Sean McBride, B. Eng s...@rogue-research.com Rogue Research www.rogue-research.com Mac Software Developer Montréal, Québec, Canada ------------------------------------------------------------------------------ The Go Parallel Website, sponsored by Intel - in partnership with Geeknet, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials, tech docs, whitepapers, evaluation guides, and opinion stories. Check out the most recent posts - join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ libusbx-devel mailing list libusbx-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libusbx-devel