3 ms·
It takes way too much of time to code, its complex, then there is porting and mainly there is no need to use C with kind of mobile specifications we've these da
by samblr 10y ago
It takes way too much of time to code, its complex, then there is porting and mainly there is no need to use C with kind of mobile specifications we've these days. These phones are faster than computers 15 years ago.
I have been part of teams where entire stack (even UI layer) was in C. malloc() was a prohibited function by design! It was way too much of code for what could be accomplished by having c++-STL these days. But then the system specifications were very low (~130 Mhz) too.
In one of embedded projects couple of years earlier - the trade off discussion we had was whether to include boost or to have a JVM ported to it! So we 've come far away.
With good chances of myself corrected here - I 've a feeling that C will be restricted to drivers/kernel, in most systems going ahead, as everything that can be written in C in rest of layers can be written in OO languages.
eg: OS based on nodejs on top of linux-kernel: https://node-os.com/ https://node-os.com/
- rocho 10y agoCan you elaborate on why malloc() was prohibited?
- samblr 10y agoDesigning of component also involved a meticulous way of finding how much memory would be used. Most of the memory used was in stack and bss - to maintain model-and-state-machines. Predominantly these were 'static' variables. Then any allocation on heap was done using local-heap manager functions. Local-heap-manager allocated buffer of 3 or 4 sizes usually in terms of large kilo bytes - this was usually to process audio/video/image(AVI) frames. These allocation were mainly called by components involved in AVI libs. And any call to local-heap-manager had to get some sort of approval at architecture level - most of the time if it was not for AVI - it would be turned down with plenty of debate. This local-heap-manager abstracted to sort of a pipeline at system level. Only one pipeline can be active at any given state. Switch of pipeline meant - release-allocation of these large chunks of memory. Each pipeline involving say x components would use highest possible memory of say y. The error that was usually frowned upon was 'low memory' of system - this usually occured when a hardware unit was slow to process say a block of AVI. Also the total cpu load of each pipeline was also monitored.