News for hackers. Stuff that matters.
Re:Modern C++ for C Programmers (2018) by ncmncm on Friday July 23, 2021 @11:04PM (#27938077)
Mapping C++ to assembler is exactly the same as mapping C to assembler, for those operations the languages share. If you are coding reasonably, there aren't any other operations that happen at runtime. C++ does its heavy lifting, preventing bugs, at compile time.
Re:Modern C++ for C Programmers (2018) by osivertsson on Saturday July 24, 2021 @02:57AM (#27938997)
For sure C++ does a lot of heavy lifting at compile time, which shows in poor compile and link times, although it is less of a problem today than 25 years ago since hardware performance has increased.

I don’t agree that C++ automatically prevents bugs, even though using e.g. RAII can help a bit and leads to maintainable code.

If you use exceptions (you probably shouldn’t) there is one more code-path out from your code. That together with constructors/destructors being called and using STL instead of more trivial data-structures often leads to a lot bigger assembler output to trawl through if you need to.

Re:Modern C++ for C Programmers (2018) by ncmncm on Saturday July 24, 2021 @04:35PM (#27944250)
C++ doesn't "automatically" prevent bugs. You have to actually, you know, use it.

By STL I guess you mean std::string and std::vector. That is wholly optional. I would not use those in a small embedded project, except maybe at startup, and then with a custom, non-freeing bump allocator.