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. Advertising

  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. Advertising

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


    It's very bad FORTRAN, gaz.

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

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. Fao
    Replies:
    6
    Views:
    539
    gooch
    Jan 27, 2005
  2. Chris
    Replies:
    4
    Views:
    15,708
    Ben Pfaff
    May 15, 2004
  3. Martin

    typedef declares object / enum to int

    Martin, Feb 23, 2005, in forum: C Programming
    Replies:
    13
    Views:
    1,605
    Richard Bos
    Feb 24, 2005
  4. typedef enum

    , Apr 12, 2008, in forum: C++
    Replies:
    3
    Views:
    1,565
    James Kanze
    Apr 13, 2008
  5. oor
    Replies:
    0
    Views:
    1,335
Loading...

Share This Page