Hacker News new | ask | show | jobs
by elwes5 2213 days ago
Like you say it can be done in a compact way. There are some gotchas with memory though. Like you point out RTTI and exceptions. Another one people forget about is the object overhead themselves. That is not zero cost on many compilers. There usually is an abstract struct that holds the vtable or something like one. That is so you can do those cool C++ things like inheritance and mutability. Most of the time when people say 'c++' I have found they do not mean the language which is decently compact. They mean the C++ std lib. It is a distinction many do not make unfortunately.

It is becoming less and less of an issue as the more powerful SoC items have come down in price and have more memory/flash. The newer ones also usually come with a somewhat modern compiler stack. Also if you follow some of the MISRA standards in some projects it can even more radically change what you can and can not do.

1 comments

Rust avoids a lot of the C++ pitfalls out of the gate with a split core vs std library set.

Panic handling and message formatting are something that however is a known drawback in debug builds. In release builds this gets optimized away in most cases.