PDA

View Full Version : [HELP]What's the difference here?


[DOG]irinel1996
09/04/2012, 05:07 PM
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):

//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! :D

Jeffry
09/04/2012, 05:10 PM
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. :D

ViniBorn
09/04/2012, 05:12 PM
Matter of organization / identification.

Jonny5
09/04/2012, 05:12 PM
#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.