SA-MP Forums Archive
#define This_One (32) vs #define This_One 32 - 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: #define This_One (32) vs #define This_One 32 (/showthread.php?tid=337621)



#define This_One (32) vs #define This_One 32 - _Swift_ - 27.04.2012

hey Guys.

im wondering what the differance is

#define Somthing (32) /* the brackets */
vs
#define somthing 32 /* no brackets */


can anyone tell me the differance?


Re: #define This_One (32) vs #define This_One 32 - Finn - 27.04.2012

I don't think there's any use for brackets when defining single values, but for different equations and such it makes a huge difference.

pawn Code:
#define calc(%0,%1) %0 + %1

new result = 10 * calc(2, 4);

// result will be 24      10 * 2 + 4


#define calc(%0,%1) (%0 + %1)

new result = 10 * calc(2, 4);

// result will be 60      10 * (2 + 4)



Re: #define This_One (32) vs #define This_One 32 - Sphex - 27.04.2012

I personally don't use the brackets in numbers. But as Finn said, it's used with arguments primarily.


Re: #define This_One (32) vs #define This_One 32 - MP2 - 27.04.2012

But like in a_samp there's

#define INVALID_TEAM (255)

Why the brackets?