Re:Pointers Are Complicated, or What’s in a Byte?
by TheCoelacanth on Wednesday July 25, 2018 @09:35AM
(#17609097)
It's C, but it's not standard C. It uses implementation defined behavior. Every compiler has some implementation defined behavior because they would be much less useful without it.
Re:Pointers Are Complicated, or What’s in a Byte?
by pjmlp on Wednesday July 25, 2018 @09:33AM
(#17609091)
That linked implementation relies on OS primitives (sysmalloc()), implemented in C, Assembly or whatever was used to write the OS.
Try to implement malloc() on bare metal, without using either Assembly or language extensions.
malloc() is usually implemented in C [0] and to be honest I'm not sure why do you think it wouldn't be? Of course you need OS API calls to actually get some memory (unless you want to operate on statically defined memory buffer) but well it's still C.
[0] https://github.com/lattera/glibc/blob/master/malloc/malloc.c