I am about to start a new realtime project. Now there is (again) the debate about c vs c++. Yes I read about Linus and all the other threads on SO.
First I was tending more towards to use C but then I read an answer that C++ includes C. Then I read on the internet about "Embedded C++". According to this article EC++ is dead. But I think a kind of "feature guideline" for C++ could be useful to manage the complexity of C++.
So now I ask myself (and you):
Our software runs in realtime, and after spending quite a few weeks with oscilloscope, I had to concede that on our hardware (pentium M and the like) modern C++ with all of the heap allocations done by the default_allocator of its maps and deques, and all the locking done by shared_ptrs, passed every latency/jitter/determinism test we could come up with.
The OS settings (like disabling the C2 state or tuning the drivers' kernel thread priorities) had orders of magnitude stronger effects than switching to memory pool allocators or any other classic RT programming approaches. Of course we can extract more microseconds from the same hardware using strictly disciplined C, but the cost of development and maintenance of that software would dwarf the cost of a slightly more up-to-date controller.
I'd say the main guideline is to get a good digital scope.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With