[Question]Define in define
#6

Quote:
Originally Posted by Scottas
Посмотреть сообщение
There are any way to use defines in define? For example:
pawn Код:
#define one       #if !defined two #error...
So in that way, I could check entered parameters doesn't dublicated for some setup functions during compile time. Or there are any other way to do this?
Yes it is

Examples:
pawn Код:
#define RED 0xFF0000FF
#define invalidid SendClientMessage(playerid, RED, "This Player ID is not connected.");
pawn Код:
#define SetVehicleNumberPlateF(%0,%1,%2); UseBrackets\
    {\
    new formatstring[32];\
    format(formatstring,sizeof(formatstring),%1,%2);\
    SetVehicleNumberPlate(%0,formatstring);\
    }

#define UseBrackets if(negative != positive)
new bool:negative = false, bool:positive = true;
As you can see that I've used defines inside the defines.
But if you write the same define text into it's own define so the compiler will crash.

Example:
pawn Код:
#define fail_defined_variable fail_defined_variable //It loops around and there is no end
new fail_defined_variable;
In the worst case after compiling it you have to close pawncc.exe from taskmanager.
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)