What's C's biggest mistake?
Walter Bright
newshound1 at digitalmars.com
Fri Jan 1 12:11:40 PST 2010
Andrei Alexandrescu wrote:
> Walter Bright wrote:
>> Don wrote:
>>> Well, if you ask the question "what's C++'s biggest mistake?" it's
>>> much more difficult. C++'s failure to specify the ABI is enough of a
>>> reason to use C instead, I reckon. It think it's an appalling,
>>> inexcusable mistake -- it guaranteed compiled libraries 20 years
>>> later would use extern(C), not extern(C++). And that's not the worst
>>> C++ mistake.
>>
>> I'd be hard pressed to come up with C++'s biggest mistake. Perhaps it
>> was failing to address the array => pointer conversion.
>
> That's partially addressed by the ability to define somewhat
> encapsulated types like std::vector.
I agree that it is partially addressed by std::vector and std::string. But:
1. Those appeared 10 years after C++ was in widespread use, 10 years of
wandering in the desert with everyone trying to invent their own string
class.
2. It still reflects in the design of std::string, in that to preserve
the 0 termination design, it makes severe compromises.
3. The glaring fact that std::vector<char> and std::string are different
suggests something is still wrong.
4. The pointer-centric design resulted in std::iterator, and of course
iterators must go!
> Don's suggested lack of ABI is big,
> and unfortunately not addressed in C++0x. There are many smaller ones to
> follow... two that come to mind: using "<"/">" for grouping and
> argument-dependent lookup.
I would suggest a broader issue than < >, it is the willingness to
require semantic analysis to successfully parse C++. < > would never
have been used if that was not considered acceptable. Only later did the
C++ community realize there was value in parsing things without semantic
analysis, i.e. template bodies.
ADL was a fix for another issue, the asymmetric design of operator
overloading. So I don't think ADL was a mistake so much as what C++ was
forced into to compensate for a previous mistake.
More information about the Digitalmars-d
mailing list