Thread: enum [tag] [: type] Is this non-standard?

  1. #1
    Registered User
    Join Date
    Jun 2007
    Posts
    41

    Question enum [tag] [: type] Is this non-standard?

    Is defining the data type of an enumeration "non-standard"? (non-standard is probably a ambiguous term, but I'm sure you know what I'm asking)

    Example:
    Code:
    enum foo:short{foo1, foo2};
    I just find it unusual that when I compile with Warning level set to maximum [using VC 2005] that it fires off the warning:

    warning C4480: nonstandard extension used: specifying underlying type for enum 'Test'
    The warning of "non-standard extension" raises my eyebrow. Should I not be trying to define the type of my enum? [My Google searches didn't turn up much]

    The following definition of enum is taking directly off of MSDN:
    enum [tag] [: type] {enum-list} [declarator]; // for definition of enumerated type

  2. #2
    Registered User
    Join Date
    Apr 2006
    Posts
    2,149
    It is nonstandard, but it is expected to be part of the C++0x standard.
    It is too clear and so it is hard to see.
    A dunce once searched for fire with a lighted lantern.
    Had he known what fire was,
    He could have cooked his rice much sooner.

  3. #3
    Registered User
    Join Date
    Jun 2007
    Posts
    41

    Thumbs up woah

    Woah, I should keep up with the times. Never heard of the term C++0x standard, but Wikipedia'ed itand thats a lot of great info. Certainly cleared up my question and more.. thanks.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. enum with assignments is standard?
    By mynickmynick in forum C Programming
    Replies: 3
    Last Post: 02-26-2009, 05:48 PM
  2. Odd enum error...
    By tjpanda in forum C++ Programming
    Replies: 2
    Last Post: 09-13-2008, 03:08 AM
  3. accessing enum members
    By stanlvw in forum C++ Programming
    Replies: 1
    Last Post: 07-24-2008, 02:58 PM
  4. Using c++ standards
    By subdene in forum C++ Programming
    Replies: 4
    Last Post: 06-06-2002, 09:15 AM
  5. standard language, standard compiler?
    By doubleanti in forum A Brief History of Cprogramming.com
    Replies: 8
    Last Post: 09-03-2001, 04:21 AM