Having duplicate enumerator values

Posted by whirlwin on Stack Overflow See other posts from Stack Overflow or by whirlwin
Published on 2011-11-20T00:47:24Z Indexed on 2011/11/20 1:51 UTC
Read the original article Hit count: 215

Filed under:
|

I'm creating a Tetris clone in C++, and I have an enum GameProperty, which is specified as follows:

enum GameProperty {
    NUM_OF_TETROMINOES  = 7,
    NUM_OF_TILES        = 4,
    TETROMINO_ROTATIONS = 4
};

In my case, I only use these values when looping through a tetromino's tiles, e.g:

for (int i = 0; i < TETROMINO_TILES; i++) { }


Is it under any circumstance considered bad practice to have multiple enumerators with the same value?

© Stack Overflow or respective owner

Related posts about c++

Related posts about enums