3 ms·
Dynamic memory is forbidden in my applications anyway. My customers make that very clear. In C I can see every alloc very clear. I fear by using c++ libraries I
by Surac 1y ago
Dynamic memory is forbidden in my applications anyway. My customers make that very clear. In C I can see every alloc very clear. I fear by using c++ libraries I get some new or mallocs hidden in layers of code.
I have not found a list of stl classen safe for embedded. That would be nice
- uecker 1y agoWhere do you see the advantage of using C++ then? What STL class would be useful without dynamic allocation? What I missed from C++ was vector, but this requires allocation and one can now do this in C too. For array handling, you can get better bounds checking in C and one can also define a decent span type.
- fuhsnn 1y agoThere are alternative STL-like libraries designed for embedded use: https://github.com/ETLCPP/etl https://github.com/ETLCPP/etl
- Surac 1y agoi see the benefit of c++ in the following points. Using Classes to hide away details, References as more safe pointers, Constructors/Destructors for stack based objects, more strict const handling, function overloading, operator overloading, hiding default or copy constructors, getter and setter with active code behind, namespaces, static classes to group helper functions, unifined init syntax over all datatypes, more strict type conversion rules, Templates, enum as real types
- beardyw 1y agoIt depends on how much headroom you have in memory, but C is the safe option. When you have 64 bytes of working (non program) memory, you pretty much need to declare everything up front anyway, so no stack either. It all depends.