Posted February 22, 2019

In particular, for embedded, here are the sort of features that are important:
* Not needing a garbage collector, and not need a substantial runtime (garbage collectors are terrible for real-time, and apparently also need a lot of extra RAM to be efficient, which we may not have)
* Be able to run without the standard library (there may not be one available, and there may not be enough space for one); this includes not having the usual start files
The standard library and a couple built-in features allocate memory using/relying on the garbage collector, but it's possible to avoid it or supply a different memory allocation removing those needs. Last i remember a portion of the Standard library was moving more functions away from the garbage collector.
But it really depends on what features are needed in an embedded system, and how much of the environment needs setting up before it's used. If it's number crunching and you don't need text processing or are appending/manipulating arrays and classes, avoiding the GC is fairly easy.
If you don't rely on the GC/STDLib/LTS, you could likely write structs and/or functions and call them from C/C++ avoiding the Standard library and runtime altogether (as they just have stack allocation during the call and cleanup afterwards). Though name mangling might be a pain, so limit the public/visible API.

* Be able to read and write to arbitrary memory locations (this may be used to access hardware registers that are mapped into the address space, or for DMA if the system supports it) (In C, this can be done easily by casting an integer to a pointer)
So, how does D fare in this respect?
Though there isn't the violate keyword, which i would think is the biggest worry on this front.
Post edited February 22, 2019 by rtcvb32