On 2013.02.18 18:56, Ludovic Rousseau wrote:
>> Of course, you're free to push them yourself if you feel like it.
>
> Ok. Pushed now.

Alright, thanks. And for the subsequent commits as well.

Note that I just pushed a fix for broken compilation on WDK (that was 
broken ever since WinCE integration due to header reshuffle in libusbi.h).

I have now tested compilation with VS2012, WDK and cygwin, and thinks 
look good.
For the record, I'm getting the dev_info warning in cywgin with default 
compilation options, so we must have changed something (relatively) 
recently there.

> 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.

Plus, the less real-estate is wasted on initialization, the easier the 
code is to follow.

> No initialization at all is also a valid solution. I do not have any
> warning in this case.

I have vague memories of Clang complaining about some of these structs 
not being initialized.
Looking at the code, I think we should be OK (we should break out of the 
loop whenever we fail to write data into dev_info_data), but I'm not 
sure Clang will be smart enough to see it that way.

Also, in case I'm wrong, I'd hate to find out that there's one compiler 
out there that doesn't zero a struct by default, and produces hard to 
troubleshoot errors as a result. I've already been through something 
like that with cygwin, and it was both painful and super time consuming.

Do we have reasons to believe that gcc will fail to zero the whole 
struct content here? The warning is just a "may"...

Regards,

/Pete


------------------------------------------------------------------------------
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

Reply via email to