But wouldn't you love a C with things like first class support for arrays and support for namespaces / modules, etc.
But wouldn't you love a C with things like first class support for arrays and support for namespaces / modules, etc.
You know how they work, how far you can push them, the overhead, and all.
Do I really know how much cycles/stack it takes to do std::sort(a.begin(), a.end()); in that specific platform? No, so I cannot trust it.
I know it's reinventing the wheel, but I am sure that there are known simple libraries out there one can use. I use mine.
What I would like is a better precompiler, like assigning dynamic values to constants. But I won't change the language for that.
I also don't know how many cycles it takes for my implementation of quicksort apart from checking the output of a specific compiler and counting instructions. C is not, was not and will never be a portable assembler.
On any modern out-of-order CPU, that doesn't get you close to determining the dynamic performance. Even with full knowledge of private microarchitectural details, you'd still have a hard time due to branch prediction.
Simple predictability ends at 16-bit CPUs generally, and even those can be tricky if it's say m68k.
All of Cortex M is in-order and only M7-- still somewhat exotic-- has a real cache (silicon vendors often do some modest magic to conceal flash wait states, though).
Alignment requirements are modest and consequences are predictable. Etc.
About the most complicated performance management thing you get is the analysis of fighting over the memory with your DMA engine. And even that you can ignore if you're using a tightly coupled memory...
To me that "sometimes" feels like "I can wrestle some bears with my bare hands, e.g.a Teddy bear" ;-)