12.07.2014, 19:17
@sammp : The only differences between this :
And this
Are :
• The use of booleans just takes a byte (or 4, i don't exactly remember) in memory (instead of a 32 bytes integer, which, as its name says, takes 32 bytes).
• Using booleans and the direct way of checking a value ( "if(variable)" or "if(!variable)"), you code faster and you are sure to check only a value.
And btw, if using booleans is useless, then using programming convention is useless. (all the programming convention does is to make a code clearer, what a pointless feature don't you think ?)
This way, using the #define directive becomes also useless because all it does is to define a macro that we can code ourself each time. (again, so useless)
Just use your common sense : if the booleans were created, it's because of a very good reason.
pawn Code:
new variable = 0;
if(!variable) // or if(variable == 0)
variable = 1;
if(variable) // or if(variable == 1)
return 1;
pawn Code:
new bool:variable = false;
if(!variable)
variable = true;
if(variable)
return 1;
• The use of booleans just takes a byte (or 4, i don't exactly remember) in memory (instead of a 32 bytes integer, which, as its name says, takes 32 bytes).
• Using booleans and the direct way of checking a value ( "if(variable)" or "if(!variable)"), you code faster and you are sure to check only a value.
And btw, if using booleans is useless, then using programming convention is useless. (all the programming convention does is to make a code clearer, what a pointless feature don't you think ?)
This way, using the #define directive becomes also useless because all it does is to define a macro that we can code ourself each time. (again, so useless)
Just use your common sense : if the booleans were created, it's because of a very good reason.