Pre-processor issue
#1

I seem not to understand this issue for the past hours and it makes no sense to me.

Ok, to the example:

pawn Код:
#define NUMBER (0)
#define RANDOM (1)
Then in another file I got this:

pawn Код:
#if defined NUMBER
    #if NUMBER == 0
        #undef NUMBER
        #undef RANDOM
        #define NUMBER (1)
        #define RANDOM (2)
        #endinput
    #elseif NUMBER == 1
       ....
It works just like y_unique from YSI really, except that the defines don't do the same as they do there. The problem is however, no matter how many times I include it it doesn't seem to think "NUMBER" is defined. There is no spelling mistake with it!

I ended up changing the system so that there is only #if NUMBER == 0 etc without any #elseif or #if defined and now it actually increased by 1, while it should have increased by 4. Its really frustrating me and I don't see a reason for it not to work.

I also don't do the mistake that I simply end the input because unique is already included. It makes no sense, please help.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)