Re: What's your C++ skill level?
Stefan Ram wrote:
Walter Bright <newshound1@digitalmars.com> writes:
The Digital Mars C++ compiler was originally in C, but that was for
bootstrapping reasons, as it was the first native C++ compiler on DOS.
It's now in C++.
?In C++? can mean:
- The C source code was changed just so much that it
now can be compiled with a C++ compiler.
Or:
- It was rewritten in ?idiomatic C++? using C++ I/O,
C++ containers and algorithms, possibly boost,
template metaprogramming, ?export? and all that stuff
whereever it is recommended by recommended C++ text
books.
One thing about C++ (and D!) is you can write in a quite vast array of
very different programming styles. The Digital Mars compiler source code
isn't written in any paragon of C++ programming virtue, it shows its
ancestry of being once C, but it is in C++ and does use C++ features.
The newer layers in it tend to be more C++ than the older dinosaur brain
parts.
(The Digital Mars C++ source code is now available, so anyone can look
at it and decide for themselves. Don't blame me if it makes you blind
and bald :-) )
The difference between these two possibilities should be
larger than the difference between C and the first
possibility (which is covered by
http://david.tribble.com/text/cdiffs.htm
). In 2007, Linus Torvalds wrote:
?[T]he only way to do good, efficient, and system-level
and portable C++ ends up to limit yourself to all the
things that are basically available in C.?
Remember that DMC++ started in 1985 or so, at the start of the great OOP
boom, predating much of what is considered modern idiomatic C++ style.
All production quality C++ compilers started at least 15 years ago, long
before Andrei's "Modern C++ Design", long before Boost, long before even
the STL. DMC++'s code base starts in 1982, it's the oldest production
C++ compiler I know of.
The D programming language front end code base is much newer, and makes
more extensive use of C++. It's not in D for bootstrapping reasons.
As for C++ I/O, meaning iostreams, I disliked it from the beginning.
Other than type safety, it's got nothing to recommend it:
1. Overloading << and >> is astonishingly unreadable. Throw templates
on top of it, and it's just a trainwreck.
2. It's slow.
3. Bloated code is generated.
4. It's not thread safe.
5. It's not exception safe.
Of course, it was developed before templates, exceptions, and any
support for threads, so the design is understandable, but that's not a
recommendation.
DMC++'s internal I/O is custom for performance reasons (and even used to
be in assembler).
Consider also that, as far as I know, I'm the only person to have
written a C++ compiler from preprocessor to object file output. Anyone
else writing one will be taking the pragmatic approach of using some
existing optimizer/back end, and so will have to deal with whatever
language that is written in (probably C).
----
Walter Bright
Digital Mars
http://www.digitalmars.com
Free C, C++, D programming language compilers
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]