Home > Gcc Error > Gcc Error Comma At End Of Enumerator List

Gcc Error Comma At End Of Enumerator List

Extra Comma in enum is Valid? P: n/a Sriram Rajagopalan Hi, Is the extra comma at the end of an enumerator-list valid according to the C standards? Or if you install htslib in a standard place, you won't need -I/-isystem at all and this warning should disappear even with -pedantic. The concept is clear now. -Sriram. http://blogeurope.net/gcc-error/gcc-error-list.php

Christian Nov 15 '05 #4 P: n/a Sriram Rajagopalan Thanks for all of your comments. passing enum value as an argument Browse more C / C++ Questions on Bytes Question stats viewed: 2532 replies: 5 date asked: Nov 15 '05 Follow this discussion BYTES.COM 2016 In the FreeBSD 5.5 system version of gcc, this prints a warning (or an error, with g++) if the -pedantic flag is passed: $ gcc -pedantic -I /usr/local/include -c foo.c In With the gcc compiler the following is valid: enum DAYS {MONDAY, TUESDAY, }day1; gcc does not even *warn* about the extra comma after "TUESDAY". http://stackoverflow.com/questions/1002462/gcc-is-it-possible-to-disable-the-comma-at-end-of-enumerator-list-warning-whe

How to draw a path with coordinates defined by f(x) What do I do when two squares are equally valid? Cheers, John -- The Wellcome Trust Sanger Institute is operated by Genome Research Limited, a charity registered in England with number 1021457 and a company registered in England with number 2742969, Nov 15 '05 #3 P: n/a Christian Kandeler Sriram Rajagopalan wrote: Is the extra comma at the end of an enumerator-list valid according to the C standards? Terms Privacy Opt Out Choices Advertise Get latest updates about Open Source Projects, Conferences and News.

Please help me confirm on this. Nov 15 '05 #1 Post Reply Share this Question 5 Replies P: n/a Krishanu Debnath Sriram Rajagopalan wrote: Hi, Is the extra comma at the end of an enumerator-list valid according Format For Printing -XML -JSON - Clone This Bug -Top of page Home | New | Browse | Search | [help] | Reports | Product Dashboard Privacy Notice | Legal Terms Not the answer you're looking for?

Similar topics extra comma A Complete ENUM++ (from Besser's CUJ article) Example Has anyone used enum.h from Besser's ENUM++? If you want gcc to give c89-specific warnings, use the right compilation options. enum-specifier syntax in c89 : ------------------------------- enum identifieropt { enumerator-list } enum identifier enum-specifier syntax in c99 : -------------------------------- enum identifieropt { enumerator-list } enum identifieropt { enumerator-list , } enum All Rights Reserved.

Problems Compiling enum.h from ENUM++ Q: Why casting an enum? How to limit a xorg installation to a single video driver? What you can do is fix the headers yourself, generate a patch, and then apply that patch to later versions of the headers if you upgrade the library. Thanks!

I'm using GCC 4.0, running Xcode on Mac OS X Leopard. https://bytes.com/topic/c/answers/805031-trailing-commas-end-enumeration However, you're looking to have gcc basically treat these files as system headers, so you might try passing "-isystem /usr/local/ffmpeg" (or wherever you installed that package) to get gcc to ignore We have a policy dictating that these flags should be turned on during development and actually this is the only warning I get. > Anyway, GCC (including 4.4.7) emits this warning Let me know if i need to file another bug for that.

If it's a .cc or .cpp file GCC uses a C++ compiler. check my blog I get it. I found references which say that this is valid in C99 standard but invalid in C89. Yes, I can see those reasons. > > And in fact they are accepted as an extension in your GCC 4.4.7.

Please help me confirm on this. Thank you all! http://www.nongnu.org/hcb/#enum-specifier http://www.open-std.org/jtc1/sc22/wg...fects.html#518 No, they're not. this content The trailing commas won't be legal until the new C++ standard is published.

Show that a nonabelian group must have at least five distinct elements Why do train companies require two hours to deliver your ticket to the machine? I'm still not very sure if this is a bad style or not? In the meantime, however, while I might consider allowing them for internal use, I certainly wouldn't deliver any code to outside the firm which uses them. -- James Kanze (GABI Software)

Format For Printing -XML -JSON - Clone This Bug -Top of page Home | New | Browse | Search | [help] | Reports | Product Dashboard Privacy Notice | Legal Terms

Please note how my new pedwarn breaks the pattern in maybe_warn_cpp0x. Due to an oversight, there were illegal in C90, however, and C++ adopted the C90 definition of enums, so they're illegal in C++03. You already answered your own question. The C++ Standard (7.2) forbids such declaration: enum-specifier: enum identifier { enumerator-list } enumerator-list: enumerator-definition enumerator-list , enumerator-definition while C99 (6.7.2.2) clearly allows: enum-specifier: enum identifier { enumerator-list } enum identifier

In file included from /home/peterJo/local/htslib-1.2.1/include/htslib/sam.h:30, from prog.cc:27: /home/peterJo/local/htslib-1.2.1/include/htslib/hts.h:140: warning: comma at end of enumerator list /home/peterJo/local/htslib-1.2.1/include/htslib/hts.h:162: warning: comma at end of enumerator list Cheers, Peter Thread view [Samtools-devel] compiler warning: comma The next version of C++ adopts C99 as its base, and they will be legal. Why does argv include the program name? have a peek at these guys Screenshot instructions: Windows Mac Red Hat Linux Ubuntu Click URL instructions: Right-click on ad, choose "Copy Link", then paste here → (This may not be possible with some types of

Messages msg2375 (view) Author: werner Date: 2008-03-11.07:58:51 Fixed in my working copy. Like this: enum Abc { ENUM_ONE, ENUM_TWO ENUM_THREE, #ifdef HAVE_SOMETHING ENUM_FOUR, #endif ENUM_FIVE, }; I believe this isn't very good to give away such a thing, because for example gcc with No, thanks Issue889 Issues Show Unassigned Show All Search Login Remember me? XML Schema enumeration question structure in Python Browse more C / C++ Questions on Bytes Question stats viewed: 4092 replies: 6 date asked: Jun 27 '08 Follow this discussion BYTES.COM

What (combination of) licenses is popular for public/shared proprietary software (“Feel free to contribute, but only we can make commercial use”)? It is valid according to the current C standard. Last Comment Bug722011 - [skia] Comma at end of enum list is not valid in c++ Summary: [skia] Comma at end of enum list is not valid in c++ Status: RESOLVED I'm still not very sure if this is a bad style or not?

share|improve this answer answered Oct 5 '08 at 19:40 friol 5,18232966 add a comment| up vote -2 down vote You can't tell GCC to be pedantic about some headers and not It's quick & easy. I'm still not very sure if this is a bad style or not? No warning when "-std=99" is used.

And the customer might be disappointed (in case he'll use "-pedantic"), and disappointed justly. Jan In the generation of code, it is often inefficient to try and figure whether to not emit the trailing comma. I found references which say that this is valid in C99 standard but invalid in C89. Browse other questions tagged gcc compiler-construction compiler-errors or ask your own question.