Originally Posted by
Spidey
Yes, that is true as well.
Also, not sure if you left this out on purpose but every case needs a break as well otherwise it will fall through to the next one.
That is actually the main feature you lose out on when you cannot use a switch/case. You can do something like this though.
Code:
namespace Case
{
void moveup(void);
void moveback(void);
void moveleft(void);
void moveright(void);
void jump(void);
}
int position;
#define CASE(condition, action) if (position == condition) { action } else
#define DEFAULT(action) action
int main(void)
{
// code goes here...
CASE(0, moveup(); jump();)
CASE(vector1.end(), moveright();)
DEFAULT(moveleft();movedown();)
return 0;
}
Admittedly its not as intuitive to write, but it reads pretty clearly, yet uses a nasty global...