Back to Index

Bjarne Stroustrup: C++ Implementations - Clang, GCC, Microsoft, and EDG


Chapters

0:0 Intro
0:30 Multiple implementations
1:0 Backend infrastructure
1:30 Compilers
2:30 Monoculture
3:0 Barriers
3:30 Competition
4:0 Conclusion

Transcript

So is there differences in your view, not saying which is better or so on, but differences in the different implementations of C++? Why are there several sort of maybe naive questions for me? GCC, Clang, so on. This is a very reasonable question. When I designed C++, most languages had multiple implementations.

Because if you run on IBM, if you run on a Sun, if you run on a Motorola, there was just many, many companies and they each have their own compilation structure and their old compilers. It was just fairly common that there was many of them. And I wrote C front, assuming that other people would write compilers for C++ if I was successful.

And furthermore, I wanted to utilize all the backend infrastructures that were available. I soon realized that my users were using 25 different linkers. I couldn't write my own linker. Yes, I could, but I couldn't write 25 linkers and also get any work done on the language. And so it came from a world where there was many linkers, many optimizers, many compiler front ends, not to start, but many operating systems.

The whole world was not an 86 and a Linux box or something, whatever is the standard today. In the old days, they said a set of X. So basically I assumed there would be lots of compilers. It was not a decision that there should be many compilers. It was just a fact.

That's the way the world is. And yes, many compilers emerged. And today there's at least four front ends, Clang, GCC, Microsoft, and EDG. It is design group. They supply a lot of the independent organizations and the embedded systems industry. And there's lots and lots of backends. We have to think about how many dozen backends there are because different machines have different things, especially in the embedded world, the machines are very different.

The architectures are very different. And so having a single implementation was never an option. Now I also happen to dislike monocultures. Monocultures? They are dangerous because whoever owns the monoculture can go stale and there's no competition and there's no incentive to innovate. There's a lot of incentive to put barriers in the way of change because, hey, we own the world and it's a very comfortable world for us.

And who are you to mess with that? So I really am very happy that there's four front ends for C++. Clang's great, but GCC was great, but then it got somewhat stale. Clang came along and GCC is much better now. Competition is good. Microsoft is much better now. So at least a low number of front end puts a lot of pressure on standards compliance and also on performance and error messages and compile time speed, all this good stuff that we want.

Do you think, crazy question, there might come along, do you hope there might come along an implementation of C++ written, given all its history, written from scratch? So written today from scratch? Well, Clang and the LLVM is more or less written from scratch. But there's been C++ 11, 14, 17, 20.

You know, there's been a lot of... I think sooner or later somebody is going to try again. There has been attempts to write new C++ compilers and some of them has been used and some of them has been absorbed into others and such. Yeah, it'll happen. Yeah. Yeah. Yeah.

Yeah.