Re: Is pointer syntax logical?
Re: Is pointer syntax logical?
- Subject: Re: Is pointer syntax logical?
- From: Jyrki Wahlstedt <email@hidden>
- Date: Thu, 26 Jul 2007 15:15:04 +0300
On 26.7.2007, at 15.02, Steve Bird wrote:
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?
And any programmer can deduce that this has actually nothing to do
with Cocoa!?
!
! Jyrki Wahlstedt
! http://www.wahlstedt.fi/jyrki/
!
! Our life is no dream; but it ought to become one and perhaps will.
! PGP key ID: 0x139CC386 fingerprint: F355 B46F 026C B8C1 89C0 A780
6366 EFD9 139C C386
_______________________________________________
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