View Single Post
Lee
AlliedModders Donor
Join Date: Feb 2006
Old 10-26-2008 , 14:42   Re: [TUT/INFO] Condition operator aka ? and :
Reply With Quote #16

I wouldn't call that strange at all. Then again, what one considers strange is heavily dependent on past experience and as I'm sure you know, different languages have different precedence rules. Superfluous parentheses happen to be a pet peeve of mine. They're certainly useful in complicated expressions, but when used as part of a trivial statement, they really annoy me. The absolute worst:

Code:
write_byte((0<<1))
This happens because many people first see bit shifting in preprocessor definitions. The parentheses are a necessary part of the preprocessor definition because operators of higher precedence could be used in conjunction with the macro, but are useless in this instance.

I think your advice about using parentheses if in doubt is sound as long as people make some kind of an effort to familiarise themselves with Pawn's precedence rules (page 112).

Can you tell that I've been wanting to get that off my chest for a long time? More good advice; take no notice of me and worry about getting stuff done.
__________________
No support via PM.

Last edited by Lee; 10-26-2008 at 14:58.
Lee is offline