On Sun, Jan 13, 2013 at 4:47 AM, Ludovic Rousseau
<ludovic.rouss...@gmail.com> wrote:
> 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]
>
It's also a MSC extension.

> 2- zero sized arrays are used in libusb/libusbi.h but NOT in the
> public libusb/libusb.h. So it is internal only.
>
It IS used in libusb/libusb.h. See
https://github.com/libusbx/libusbx/blob/master/libusb/libusb.h , line
979.

> 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?
>
Unfortunately, no.


Regards,
Jie

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