bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] mbsrtowcs-state.c, wcsrtombs-state.c: avoid compilation fail


From: Micah Cowan
Subject: Re: [PATCH] mbsrtowcs-state.c, wcsrtombs-state.c: avoid compilation failure
Date: Tue, 28 Apr 2009 10:21:47 -0700
User-agent: Thunderbird 2.0.0.21 (X11/20090318)

Ben Pfaff wrote:
> Eric Blake <address@hidden> writes:
> 
>> Jim Meyering <jim <at> meyering.net> writes:
>>> -mbstate_t _gl_mbsrtowcs_state = 0;
>>> +mbstate_t _gl_mbsrtowcs_state = { 0, };
>> Is this correct for all platforms?  If I read Posix correctly, mbstate_t can 
>> be 
>> a numeric type rather than a struct.
> 
> The initializer for an object scalar type may optionally be
> enclosed in braces.  From C99 6.7.8 "Initialization", paragraph
> 11:
> 
>         The initializer for a scalar shall be a single
>         expression, optionally enclosed in braces.
> 
> C89 had similar text.

Yes. What about the comma, though? GCC doesn't complain (even with -ansi
-pedantic), but I think a very strict reading might suggest a conforming
implementation could consider it to have undefined behavior ("shall").

-- 
Micah J. Cowan
Programmer, musician, typesetting enthusiast, gamer.
Maintainer of GNU Wget and GNU Teseq
http://micah.cowan.name/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]