xfconf-errors.h enum error

Brian J. Tarricone brian at tarricone.org
Mon Aug 3 22:30:35 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.

Works fine here:

$ g++ --version
g++ (Gentoo 4.3.2-r3 p1.6, pie-10.1.5) 4.3.2
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ cat main.h
extern "C" {

typedef enum
{
     FOO_A,
     FOO_B,
     FOO_C,
} FooEnum;

}
$ cat main.cpp
#include "main.h"
int main(int argc, char **argv) { return 0; }
$ g++ -Wall main.cpp
$ ls -l a.out
-rwxr-xr-x 1 brian brian 8.0K 2009-08-03 13:15 a.out*

> In other words ... I think it is an error. If you look at page 215 in
> K&R (second ed), you will see that en enumerator-list does not have a
> tailing comma :-)

I would most certainly not use a K&R C book when looking or examples as 
to what is or isn't valid C these days.  Trailing commas in enums are 
just fine, and I prefer writing code that way so changing the enum later 
(to add or remove items) reduces diff/vcs clutter.

[/me googles a bit...]

Ah, I see.  Stop compiling with -pedantic and you'll be fine ^_~.  I 
don't test with -pedantic and don't guarantee any of my code will 
compile with it.

	-brian



More information about the Xfce4-dev mailing list