• 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: Is pointer syntax logical?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is pointer syntax logical?


  • Subject: Re: Is pointer syntax logical?
  • From: Steve Bird <email@hidden>
  • Date: Thu, 26 Jul 2007 08:02:25 -0400


On Jul 26, 2007, at 7:52 AM, Jacob Engstrand wrote:


On 26 jul 2007, at 12.14, Alastair Houghton wrote:

On 26 Jul 2007, at 08:58, Bob Ueland wrote:

[...deletia...]

Some people *insist* on writing the asterisk (or in C++ the ampersand) in the wrong place, e.g.

Fraction* aFraction;



This one again! I really shouldn't go for this obvious bait, but in the interest of signal/noise (and so we can kill this thread right here and now), I will attempt to end this thread by giving C++ inventor Bjarne Stroustrup the last word:


A ``typical C programmer'' writes ``int *p;'' and explains it ``*p is what is the int'' emphasizing syntax, and may point to the C (and C++) declaration grammar to argue for the correctness of the style. Indeed, the * binds to the name p in the grammar.

A ``typical C++ programmer'' writes ``int* p;'' and explains it ``p is a pointer to an int'' emphasizing type. Indeed the type of p is int*. I clearly prefer that emphasis and see it as important for using the more advanced parts of C++ well.

And a programmer coming from Pascal tends to write "int* p1, p2;" preferring the "C++" approach, and fails to understand why he does not get TWO pointers. After all, "int*" is supposed to be a type, is it not?


----------------------------------------------------------------
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
www.Culverson.com                     (toll free) 1-877-676-8175


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Is pointer syntax logical?
      • From: Jyrki Wahlstedt <email@hidden>
References: 
 >Is pointer syntax logical? (From: Bob Ueland <email@hidden>)
 >Re: Is pointer syntax logical? (From: Alastair Houghton <email@hidden>)
 >Re: Is pointer syntax logical? (From: Jacob Engstrand <email@hidden>)

  • Prev by Date: Re: Is pointer syntax logical?
  • Next by Date: Re: Enabling menu items?
  • Previous by thread: Re: Is pointer syntax logical?
  • Next by thread: Re: Is pointer syntax logical?
  • Index(es):
    • Date
    • Thread