3 ms·
What? Linux is written in C and it there is no malloc in the kernel. Just don't include standard library.
by ttt0 6y ago
What? Linux is written in C and it there is no malloc in the kernel. Just don't include standard library.
- astrange 6y agoLinux isn't written in C either, it's written in C with a lot of language extensions. The ability to implement malloc() is just another language extension where the compiler promises to ignore the type aliasing issues. Implementing memory barriers (pthread_mutex_lock()) used to be strictly speaking impossible in C too, but it's possible now that it has a defined memory model.
- mhh__ 6y agoIgnoring that the kernel has lots of raw machine code in it, "not possible" and undefined or implementation defined behaviour are different things either practically or in terms of programming language semantics.