2013/1/13 Pete Batard <p...@akeo.ie>:
>> As I said above, this piece of code is safe.
>
> Can you prove it?

Some remarks
1- a zero sized array is illegal in C. It is a GCC extension. See [1]

2- zero sized arrays are used in libusb/libusbi.h but NOT in the
public libusb/libusb.h. So it is internal only.

3- gcc -pedantic reports the non-conformance
In file included from io.c:37:
libusbi.h:301: warning: ISO C forbids zero-size array 'os_priv'

4- gcc -pedantic do not report a warning when compiling the examples.
This confirms that it is internal only, no need to push _this_ #pragma
in the public libusb.h

5- we should use a flexible array member [1] with a C99 compiler.  Is
MSVC C99 comliant?

Bye

[1] http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Zero-Length.html

-- 
 Dr. Ludovic Rousseau

------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_123012
_______________________________________________
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel

Reply via email to