News for hackers. Stuff that matters.
Re:After All These Years, the World Is Still Powered by C Pr... by shpx on Saturday April 01, 2017 @09:29PM (#14015207)
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/

Re:After All These Years, the World Is Still Powered by C Pr... by humanrebar on Saturday April 01, 2017 @09:45PM (#14015284)
> 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.

Re:After All These Years, the World Is Still Powered by C Pr... by stephen82 on Sunday April 02, 2017 @01:38PM (#14018075)
You 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.

Re:After All These Years, the World Is Still Powered by C Pr... by coldtea on Sunday April 02, 2017 @10:28AM (#14017285)
>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.

Re:After All These Years, the World Is Still Powered by C Pr... by pandaman on Sunday April 02, 2017 @01:56PM (#14018166)
One can use a compiler switch to disable exceptions in every popular C++ compiler.
Re:After All These Years, the World Is Still Powered by C Pr... by ksec on Sunday April 02, 2017 @08:14AM (#14016867)
>The C subset of C++ is as efficient as C.

this.