Re: Abandonment of aggregate types
"Frederick Gotham" <fgothamNO@SPAM.com> skrev i meddelandet
news:DO1Hg.13005$j7.325536@news.indigo.ie...
NOTE: I have already replied to this, but for some idiotic reason,
it wasn't
let through (or maybe it's another case of my posts showing up three
days
later -- either way, the moderators are doing a bad job).
I think the moderators do a good job - most often my silly remarks are
not let though. :-)
In this case I believe that I have a point though, something about C++
being a multi paradigm language. There really is no One True
Style(tm), it depends on how we use the language, and what paradigm we
subscribe to.
I am surprised that the moderation process would let this blasfemy
pass. Don't listen to the false profet!
Your understanding is false. Mine is true, and is re-enforced by the
following:
int *p, *q, r[5], (*s)[5], *t[5], Func(), *Func2();
p is a pointer.
q is a pointer.
r is an array of five.
s is a pointer to an array of five.
t is an array of five pointers.
Func is a function which returns an int.
Func2 is a function which returns a pointer to an int.
I agree that this is allowed by the language because of its
inheritance, but also believe that we should not use it this way -
it's a C-ism. This is where it gets religious! Some things are
possible, but should be avoided anyway. On "moral" grounds perhaps?
You want:
T *&p_t
No, you definitely want
T*& p_t
Convince him.
Convice who? This is what triggered my response.
In my mind, this is similar to "should I be a catholic or a
protestant?". How do we know what is right? Could they both be true?
If I'm a protestant, should I be a baptist, or a member of the
Salvation Army? Don't know.
Perhaps I use C++ very much like "C with classes", because that is how
I once learned programming, in Simula (Algol with classes). There we
had the interesting parameter "modes" pass-by-name, pass-by-value, and
pass-by-reference. I never though of the parameter passing as part of
the type.
If you use the One True Style(tm), there is never a problem with
declarations. You first fully specify the type, and then the name.
Your way of doing it gives a false impression -- it implies that the
asterisks and ampersands are part of the type's name.
And they are. :-)
That's why I used "blasphemy", because we both now that we are right
and the other one is wrong. Perhaps it didn't come out exactly as I
imagined - sarcasm is difficult in your second language.
Bo Persson
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]