3 ms·
As soon as you default to a particular policy of how to allocate, and most importantly free, memory on the heap, you have committed yourself. Low level means: n
by neokantian 8y ago
As soon as you default to a particular policy of how to allocate, and most importantly free, memory on the heap, you have committed yourself. Low level means: no commitment in that realm, aka, do what you please. The fact that you can possibly overrule that default, does not make much of a difference, because almost any language allows this.
C does not even have a standard (dynamically-sized) list concept built in, because that would amount to committing oneself to a default heap allocation/deallocation policy. All you can get is a contiguous range of bytes with some vague, default interpretation as to what it is supposed to be, through the use of malloc/free (possibly hacking it through realloc). That is why C is considered low level.
Still, in a true low-level solution, you would use the sbrk system call directly. So, in a sense, C may already "add too much value" to be considered truly low level.
- hossbeast 8y agoYou can easily can sbrk (or mmap) from C directly.
- neokantian 8y agoYes, exactly. You can even do that from any arbitrary scripting engine that supports executing arbitrary C functions. For example, here, complete access to the linux/bsd/osx system call interface, including sbrk, from lua: https://github.com/justincormack/ljsyscall https://github.com/justincormack/ljsyscall Just load libffi (https://sourceware.org/libffi https://sourceware.org/libffi) or a similar module in any arbitrary language, and off you go!
- strawberrycheez 8y ago>That is why C is considered low level. C isn't a low-level language https://queue.acm.org/detail.cfm?id=3212479 https://queue.acm.org/detail.cfm?id=3212479