View Single Post
Old Aug 31st, 2007, 10:58 AM   #1
JawaKing00
Newbie
 
Join Date: Sep 2004
Posts: 29
Rep Power: 0 JawaKing00 is on a distinguished road
Enumerations as loop variables

I've been programming in C mostly, and I've become accustomed to being able to do things like this:

typedef enum TEST_ENUM_t
{
    TEST0,
    TEST1,
    TEST2,
    TEST3
} TEST_ENUM_t;

TEST_ENUM_t TestIndex;

for (TestIndex = TEST0; TestIndex <= TEST3; TestIndex++)
{
    // Do something
}


Well, now I'm trying to do something like this for some test driver software written in Visual C++ which will be used to test C functions. When I attempt to do something like I have above in Visual C++, I get the following error:

error C2676: binary '++' : 'TEST_ENUM_t' does not define this operator or a conversion to a type acceptable to the predefined operator

Is there a way to do something similar to the code above in Visual C++?

Thank you.
JawaKing00 is offline   Reply With Quote