xfconf-errors.h enum error

Brian J. Tarricone brian at tarricone.org
Tue Aug 4 00:24:51 CEST 2009


On 08/03/2009 09:04 AM, Bo Lorentsen wrote:
> David Mohr wrote:
>> That's not an error, at least not with gcc.
> But the unfortunate people like me that happens to like using C++ (g++)
> end up not being able to include this file, and this makes it difficult
> to make C++ wrappings (XFC) for xfconf.

Ah, looked into this a bit more.  Apparently the trailing comma is 
explicitly disallowed by C89, but allowed in C99 (to be symmetric with 
the always-allowed trailing comma in array initializers).  GCC has 
supported the trailing comma as an extension in gnu89 mode (and others).

I don't know how that relates to the analogous C++ standards, or how 
standards compliance works in g++ when compiling code inside an extern 
"C" wrapper, but my guess is that -pedantic defaults to a C++ standard 
too old to allow the trailing comma in enums.

So then it just boils down to a C99 vs. C89 debate.  In the past I've 
tried to avoid C99-specific stuff in my code, but lately I've started 
relaxing this a bit, at least for the C99 features that seem to have 
been supported for longer in a decent number of compilers (how I decide 
this is of course entirely unscientific).

Anyway, this post was more an FYI sort of thing.  I don't intend to 
change these sorts of things in my code (and it's not just my code, and 
not just xfconf).

	-brian



More information about the Xfce4-dev mailing list