3 ms·
Taylor's slides list the reasons to commit to writing GCC in C++: C++ is well-known and popular. It's nearly a superset of C90, which GCC was then written in.
by shpx 10y ago
Taylor's slides list the reasons to commit to writing GCC in C++:
C++ is well-known and popular.
It's nearly a superset of C90, which GCC was then written in.
The C subset of C++ is as efficient as C.
C++ "supports cleaner code in several significant cases." It never requires "uglier" code.
C++ makes it harder to break interface boundaries, which leads to cleaner interfaces.
https://lwn.net/Articles/542457/ https://lwn.net/Articles/542457/
- humanrebar 10y ago> It never requires "uglier" code. Again, I mostly agree with everything you wrote, but this is overstating things a little. Because exception safety can be a little more complicated than it first appears, you do end up having to do a bit more work in C++ in certain cases. One example of this is writing an external ABI in C++. Depending on how nice you want to be to the consumer of your ABI, you might need to add a try...catch(...) to every public function to make sure exceptions don't escape the C++ code. There are also tricky subtleties around writing, say, a swap function in the face of constructors that might throw.
- coldtea 10y ago>One example of this is writing an external ABI in C++. Depending on how nice you want to be to the consumer of your ABI, you might need to add a try...catch(...) to every public function to make sure exceptions don't escape the C++ code. That's not "required" if you write the C++ code yourself though, as you can just refrain from using (throwing) exceptions in the first place. That's what the parent means.
- stephen82 10y agoYou can write exception free code since C++11. All you must do is to add noexcept operator at the end of your function that you don't want to throw an exception and that would do. Also, in the article it states that cars are using C. If I'm not mistaken, Bjarne himself in a couple of videos he has mentioned certain companies, like BMW and Mercedes, are using C++ for their cars and of course these two companies are not the only ones. The good thing is that C++ committee did pay attention to what people and companies have suggested and or complained for years and fixed it with the release of C++11. I really love using C myself, but I wish C had the safety C++ has by default.
- pandaman 10y agoOne can use a compiler switch to disable exceptions in every popular C++ compiler.
- ksec 10y ago>The C subset of C++ is as efficient as C. this.