3 ms·
> There's certainly plenty of evidence that someone has read this book, since otherwise we wouldn't have so many C++ compilers to choose from. I don't think th
by WalterBright 10y ago
> There's certainly plenty of evidence that someone has read this book, since otherwise we wouldn't have so many C++ compilers to choose from.
I don't think that's quite true. The only C++ compilers I know of are:
1. cfront C++ (from which many C++ compilers were derived)
2. Digital Mars C++ (the one I wrote)
3. g++
4. clang++
5. EDG C++ (from which many other C++ compilers are derived)
6. Microsoft C++
7. Taumetric C++
It's a pretty thin list for 30 years. (I apologize if I neglected any.) Contrast that with C - at one time in the 1980s I counted over 30 of them (I'm not sure how many were independent creations).
Edit: removed Borland C++ as that was derived from Taumetric.
- TickleSteve 10y ago9. Intel C++ 10. Watcom 11. IAR 12. Commeau etc.
- WalterBright 10y agoIntel is derived from EDG. Commeau is derived from Cfront. I don't know anything about Watcom C++.
- hilop 10y agoYears ago we had some banned C++ features Because they didn't compiler properly on HP-UX compiler. But maybe that was still part of the g+ umbrella
- csl 10y agoMaybe Intel C++ as well? But most people who have that book didn't buy it to write a compiler. Isn't C++ ridiculously hard to write a compiler for? While I haven't written one, I think it'd be much easier to write one for C — and for that I imagine it would very nearly suffice to have the K&R book.
- WalterBright 10y agoEvery C++ front end I know of has at least 10 man years in it. I'm pretty sure it's the hardest language to implement, by far. (The core language.) Ironically, one of the hardest things about a C compiler is the preprocessor. You'd think a text macro processor would be simple, and it should be simple. There's an amazing amount of subtle complexity in just the handful of pages describing it in the Standard. I and many others implemented a C compiler based on K+R, and I can attest that a lot of rework can be avoided if following a Standard instead (C89 did not exist at the time).
- mafribe 10y agoI'm pretty sure it's the hardest language to implement Harder than languages that require JIT compilers to achieve reasonable performance? Even scalac and ghc are pretty complex beasts in order to Scala and Haskell reasonably speedy.
- Retra 10y agoYou can sink 10 years into just about any software to make it run faster. I wouldn't think that reflects on the inherent difficulty of writing a compiler in the abstract.
- mafribe 10y agoSure, but a simplistic C++ compiler will still produce code of acceptable speed. The same is not true of simplistic compilers for languages like Javascript. Meta-tracing a la PyPy is such a revolution because it enables low-cost creation of reasonably performant tracing JIT compilers.
- wtetzner 10y agoI read the comment as saying C++ is the hardest language to implement, not the hardest language to make fast.
- 10y ago
- blub 10y agoTheir comment doesn't make sense to me. Someone working on a compiler would use the standard, right? The book is for the people wanting to know every corner of the language. Unfortunatley I read it a long time ago and don't remember if it's enough for that purpose or one still needs Meyers and maybe some other resources.
- WalterBright 10y ago> Someone working on a compiler would use the standard, right? Today, yes. But in the olden days of C++, there was no standard and people used Bjarne's book.