[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: To all german speaking 'steppers: article in german C'tmagazine <Vir
From: |
Philippe C . D . Robert |
Subject: |
Re: To all german speaking 'steppers: article in german C'tmagazine <VirusChecked> |
Date: |
Thu, 22 May 2003 00:27:43 +0200 |
Hi,
I agree with Helge on this, I do not think it make much sense to write
such a letter... but on the other hand, if it is a well written
addition to this article and not a flame against C++ then it won't
cause any harm either :-)
On Wednesday, May 21, 2003, at 09:50 PM, Stefan Böhringer wrote:
I'm going to be quite honest here: that seems like a really good idea
when we compare it to the ObjC way of wrapping C types with NSValues
and numbers with NSNumbers, which BTW can be a real performance hit.
And to me it doesn't seem to be a good idea. One can argue about this
from the performance point of view. This boils down to the general
question of performance of C++ vs. Objective-C. In this group it is
understood that Objective-C may need some hand tuning when performance
is really critical. If, however, a clean design is implemented C++ will
perform equal or worse to Objective-C. Also there are floating around
class implementations to hold arrays of c-structs (My personal class is
NSDataArray), which are even quicker than a C++-template.
Why should a clean C++ design be slower than a clean ObjC design? And C
structs can perfectly be used in C++ as well, of course, this is not an
argument for or against templates...
The deeper reason for templates is, that C++ used to be crippled before
templates were introduces. How would one implement an array of ints? Go
ahead and write your addInt(), intAtIndex(),... methods. Now, what to
do
with floats? Do another class. This generalizes to Templates where the
class is another argument.
C++ has termendous difficulties to handle container classes (classes
holding other classes). This led to the enormous complexity of the STL
(standard templates libraries; http://www.sgi.com/tech/stl) which
implements virtually hundrets of classes to perform what NSArray,
NSDictionary, NSSet, NSEnumerator do.
C++ has absolutely no difficulties in handling container classes nor
does STL implement hundreds of container classes. On the other hand,
NSArray et al. are often implemented as class clusters and thus there
are more implementations than you generally see. But then, of course is
the FoundationKit easier to use, this is IMHO no question :-)
But of course does the different nature of C++ result in different
approaches and design solutions. And although it is much more difficult
to write good C++ code, this does not mean that you cannot do it!
-Phil
--
Philippe C.D. Robert
http://www.nice.ch/~phip