• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: C
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: C


  • Subject: Re: C
  • From: Gregory Weston <email@hidden>
  • Date: Sun, 31 Aug 2003 21:36:37 -0400

On 8/31/03 at 11:49 AM, Jeff wrote:

> On Sunday, August 31, 2003, at 12:31 AM, Clark Cox wrote:
>
> > When I see extra parentheses, it makes me think "gee, this person
> > wanted something other than the default behavior". But then, when I
> > see that they actually wanted the default behavior, it usually makes
> > me think that they missed something, I then have to scour the calling
> > code to see if that's what they *really* wanted. If, on the other
> > hand, the code is written with the language's rules in mind, I know
> > that parentheses mean "I've changed the order for some reason".
>
> This strikes me as an odd reaction, especially since parentheses are
> all part of order precedence, which should simply reinforce its
> meaning. Minimal precedence coding seems to be no virtue in and of
> itself. To each their own, of course. I tend to come from the school of
> thought that comments are to supplement code which could not be made
> more clear on its own.

If I may be so presumptuous, I suspect what Clark is getting at is that he
doesn't see virtue in redundancy. Parentheses _are_ part of the precedence
scheme, but they're meant more as an override than as an operator in the
traditional sense. From a certain point of view,

z = w + (x * y);

might be considered just as obnxious as

z = w + x; /* Set z to the sum of w and x. */

You look at it and some part of the brain says: "Well, duh."

Parentheses do have value in disambiguating overly complex expressions, but an
alternative reaction to complexity - which I think Clark suggested - is to just
decompose the expression. If you've filled a 70-character line with a single
expression involving single-letter variables, I wouldn't say parentheses are the
answer.

G
_______________________________________________
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.

  • Follow-Ups:
    • Re: C
      • From: Jeff <email@hidden>
  • Prev by Date: Re: C
  • Next by Date: Re: C
  • Previous by thread: Re: C
  • Next by thread: Re: C
  • Index(es):
    • Date
    • Thread