typedef enum

Discussion in 'C++' started by qazmlp, Jul 2, 2003.

  1. qazmlp

    qazmlp Guest

    Any comments on this construct ?

    class testClass
    {
    public:
    typedef enum
    {
    SOME_CONS0 = 0,
    SOME_CONS1,
    SOME_CONS2
    } Type;
    } ;
     
    qazmlp, Jul 2, 2003
    #1
    1. Advertisements

  2. qazmlp

    Rolf Magnus Guest

    qazmlp wrote:

    > Any comments on this construct ?


    What exactly is your poblem with it?

    >
    > class testClass
    > {
    > public:
    > typedef enum


    The typedef doesn't hurt here, but it's not needed.

    > {
    > SOME_CONS0 = 0,
    > SOME_CONS1,
    > SOME_CONS2


    I usually don't use identifiers in all uppercase for enums and rather
    reserve them for preprocessor macros. I think that's a good idea, since
    that turns preporcessor marco names into kind of a red flag. You lose
    that if you use all uppercase names for anything else.

    > } Type;
    > } ;
     
    Rolf Magnus, Jul 2, 2003
    #2
    1. Advertisements

  3. qazmlp wrote:
    >
    > Any comments on this construct ?


    It's very bad FORTRAN, gaz.

    regards,
    alexander.
     
    Alexander Terekhov, Jul 2, 2003
    #3
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. -

    enum within an enum

    -, Jun 12, 2005, in forum: Java
    Replies:
    6
    Views:
    837
  2. Jerminia
    Replies:
    3
    Views:
    824
    Roedy Green
    Oct 7, 2005
  3. Ernst Murnleitner

    How to enum an enum?

    Ernst Murnleitner, Nov 12, 2003, in forum: C++
    Replies:
    5
    Views:
    786
    Rolf Magnus
    Nov 13, 2003
  4. Fao
    Replies:
    6
    Views:
    755
    gooch
    Jan 27, 2005
  5. Chris
    Replies:
    4
    Views:
    16,024
    Ben Pfaff
    May 15, 2004
  6. Martin

    typedef declares object / enum to int

    Martin, Feb 23, 2005, in forum: C Programming
    Replies:
    13
    Views:
    2,217
    Richard Bos
    Feb 24, 2005
  7. typedef enum

    , Apr 12, 2008, in forum: C++
    Replies:
    3
    Views:
    1,705
    James Kanze
    Apr 13, 2008
  8. oor
    Replies:
    0
    Views:
    1,686
Loading...