SA-MP Forums Archive
[HELP]What's the difference here? - 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: [HELP]What's the difference here? (/showthread.php?tid=332876)



[HELP]What's the difference here? - [DOG]irinel1996 - 09.04.2012

Hi,
I saw some scripts here in SA-MP Forums with a difference between macros, I mean, between defines.

I saw two ways to define an hexadecimal code for colors (just an example):
pawn Код:
//First way, without brackets.
#define COLOR    0xFF0000FF
//------
//Second way, with brackets.
#define COLOR    (0xFF0000FF)
What's the difference?

Thank you, and I'm sorry for my bad English.

Best regards!


Re: [HELP]What's the difference here? - Jeffry - 09.04.2012

I don't know any difference.
If you imagine a simple maths-exercise:

1 + 2 + 3 + 4 = 10
is the same as
(1) + (2) + (3) + (4) = (10)

So, probably no difference. If there is any, then I don't know about it.


Re: [HELP]What's the difference here? - ViniBorn - 09.04.2012

Matter of organization / identification.


Re: [HELP]What's the difference here? - Jonny5 - 09.04.2012

#define just replaces COLOR with whatever is after the first space

it will replace COLOR the first way with 0xFF0000FF
the second way with (0xFF0000FF)

it cant hurt to have the extra () but the first way could be bugged depending on your code.

so when your writing code imagine what it would look like both ways
only then will you see what the difference is.