|
|
|
|
|
by juliangmp
345 days ago
|
|
Obligatory C is not a low level language: https://queue.acm.org/detail.cfm?id=3212479 I also have to disagree with C++ for micro controllers / bare metal programming.
You don't get the standard library so you're missing out on most features that make C++ worthwhile over C.
Sure you get namespaces, constexpr and templates but without any standard types you'll have to build a lot on your own just to start out with. I recently switched to Rust for a bare metal project and while its not perfect I get a lot more "high level" features than with C or C++. |
|
Why is that? Sure, allocating containers and other exception-throwing facilities are a no-go but the stdlib still contains a lot of useful and usable stuff like <type_traits>, <utility>, <source_location>, <bit>, <optional>, <coroutine> [1] and so on
[1] yes they allocate, but operator new can easily be overridden for the promise class and can get the coro function arguments forwarded to it. For example if coro function takes a "Foo &foo", you can have operator new return foo.m_Buffer (and -fno-exceptions gets rid of unwinding code gen)