Date: Wed, 19 Apr 2006 12:11:41 +0300 From: Andrey Simonenko <simon@comsys.ntu-kpi.kiev.ua> To: Jim Rees <rees@FreeBSD.org> Cc: freebsd-bugs@FreeBSD.org Subject: Re: kern/95987: [patch] nfsproto.h has trailing ',' in enums Message-ID: <20060419091141.GA1176@pm513-1.comsys.ntu-kpi.kiev.ua> In-Reply-To: <200604181946.k3IJkTST078339@freefall.freebsd.org> References: <200604181946.k3IJkTST078339@freefall.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Apr 18, 2006 at 03:46:29PM -0400, Jim Rees wrote: > Synopsis: [patch] nfsproto.h has trailing ',' in enums > > State-Changed-From-To: open->closed > State-Changed-By: rees > State-Changed-When: Tue Apr 18 15:41:22 EDT 2006 > State-Changed-Why: > This is explicitly allowed by ANSI C "Enumeration specifiers" which > says that an enumerator-list may be followed by a comma. Not a bug. > I have only drafts of c89, c99 and c++98 and looks like, that trailing comma in enum is c99 addition. c89 3.5.2.2 Enumeration specifiers c99 6.7.2.2 Enumeration specifiers c++89 7.2 Enumeration declarations http://david.tribble.com/text/cdiffs.htm#C99-enum-decl Simple program: enum { a, }; int main(void) { return 0; } Results from GCC 3.4.4 and TenDRA 4.0 compilers on 6.1-RC/i386: % gcc -ansi -pedantic a.c a.c:3: warning: comma at end of enumerator list % gcc -std=c99 a.c % g++ a.cc % g++ -pedantic a.cc a.cc:3: error: comma at end of enumerator list % tcc -Yansi a.c "a.c", line 3: Error: [Syntax]: Extra comma at end of list. % tcc -Yc++ a.cc "a.c", line 3: Error: [Syntax]: Extra comma at end of list. % tcc -Yc99 a.c (I do not know equivalent for -pedantic for g++)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060419091141.GA1176>