[Question]Define in define
#7

Well, I'll give a better example :
pawn Код:
// Some kind of function:
#define AddSymbol(%0)

// Then use this function
AddSymbol(SYMBOL_ONE);
AddSymbol(SYMBOL_TWO);
AddSymbol(SYMBOL_THREE);
What I am trying to do, is to make that compiler would give an error, if you enter the same symbol twice, like:
pawn Код:
// Then use this function
AddSymbol(SYMBOL_ONE);
AddSymbol(SYMBOL_TWO);
AddSymbol(SYMBOL_THREE);
AddSymbol(SYMBOL_TWO);
In this case, function AddSymboll should contain something like:
pawn Код:
#define AddSymbol(%0) #if defined SYMBOL_%0 #error Symbol already exists #endif
But function like that wont compile, it gives error. So all I want to know, is it possible to make something like that?
Reply


Messages In This Thread
[Question]Define in define - by Scottas - 30.06.2011, 19:00
Re: [Question]Define in define - by Shadoww5 - 01.07.2011, 00:06
Re: [Question]Define in define - by Lilcuete - 01.07.2011, 00:19
Re: [Question]Define in define - by [LoD]Hauke - 01.07.2011, 01:03
Re: [Question]Define in define - by Shadoww5 - 01.07.2011, 01:04
Re: [Question]Define in define - by BigETI - 01.07.2011, 05:23
Re: [Question]Define in define - by Scottas - 01.07.2011, 14:12
AW: Re: [Question]Define in define - by Nero_3D - 01.07.2011, 15:47
Re: [Question]Define in define - by Scottas - 02.07.2011, 05:45

Forum Jump:


Users browsing this thread: 1 Guest(s)