SA-MP Forums Archive
Easy-to-answer question about #define value - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Easy-to-answer question about #define value (/showthread.php?tid=301431)



Easy-to-answer question about #define value - Danny - 04.12.2011

Do they use memory? I've to know this because i'm planning to use alot.


Re: Easy-to-answer question about #define value - AndreT - 04.12.2011

They're only used by the compiler.

Here is a lot of useful information for you: https://sampforum.blast.hk/showthread.php?tid=166680


Re: Easy-to-answer question about #define value - currencyinstacks - 04.12.2011

Well yes.

Код:
#define VALUE 1

new getvalue = VALUE;
if(getvalue == 1)
{
    //the value is 1
}



Re: Easy-to-answer question about #define value - Ash. - 04.12.2011

Quote:
Originally Posted by currencyinstacks
Посмотреть сообщение
Well yes.

Код:
#define VALUE 1

new getvalue = VALUE;
if(getvalue == 1)
{
    //the value is 1
}
The defines themselves don't use memory, as they're 'replaced' at compile time.

For example:
pawn Код:
#define VALUE 5
if(VALUE == 5)
Would, after compile, become:
pawn Код:
if(5 == 5)
I recommend you read the PAWN language guide.