Re: C
Re: C
- Subject: Re: C
- From: Clark Cox <email@hidden>
- Date: Sat, 30 Aug 2003 23:13:51 -0400
On Saturday, August 30, 2003, at 19:20, cricket wrote:
I find it really nice when I'm both reading and writing code to use
parentheses liberally for this reason: many editors (like PB) let you
click on one open paren and see the corresponding close paren. This
makes it FAR easier to grok complicated expressions.
If your expressions are long enough that someone would need help
understanding them, then you should try writing shorter, more concise
expressions. So, you would never write:
z = x + y * w;
You would instead write this?:
(z = (x + (y * w)));
I think forgetting the precedence rules and always using parentheses
to make thing absolutely clear is not necessarily a bad idea, as long
as you're aware they exist and know how to look them up if you need
them when reading other people's code.
Again, if parentheses are needed to make an expression readable, then
the expression is either too complex to begin with, or the person
reading it doesn't know the language (and I count knowing at least a
summary of the precedence rules as part of "knowing" the language).
Just as knowing how to read algebraic equations implies knowing the
rules of precedence for mathematical operations (i.e. there is nothing
ambigous about "y = 2x^2 + 3", we know that the exponent comes first,
then the multiplication, and then the addition), knowing how to
read/write C (or C++ or Java, etc.) implies knowing the rules of
precedence for it's operations.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
References: | |
| >Re: C (From: David Thorp <email@hidden>) |
| >Re: C (From: Clark Cox <email@hidden>) |
| >Re: C (From: cricket <email@hidden>) |