Re: Is pointer syntax logical?
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