#define This_One (32) vs #define This_One 32
#1

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?
Reply
#2

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)
Reply
#3

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

But like in a_samp there's

#define INVALID_TEAM (255)

Why the brackets?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)