3 ms·
> Later versions of C also adopt a new memory model that is very broken. You mean, adopting a memory model that properly supports multi-threaded code? > memco
by kccqzy 7y ago
> Later versions of C also adopt a new memory model that is very broken.
You mean, adopting a memory model that properly supports multi-threaded code?
> memcopy is for instance impossible to implement in C17.
What? I assume you mean memcpy? How is it impossible to implement given that it's implemented in the standard library?
> Due to these issues the Linux kernel is no longer using standrard C.
As others have mentioned, the Linux kernel never used standard C. Just search for, say, the substring "__builtin" where it uses compiler builtins directly. It's also quite recent that Linux can be compiled by clang; if it were using standard C, such compatibility issue would not arise in the first place.
- quelsolaar 7y agoThe new memory model tried to make it possible to implement fat pointers with reference counters. That means that the compiler must be able to tell when a pointer is being copied. After the spec was ratified several people pointed out that its not possible to implement memcpy(typo sorry) since memcpy doesn't know what it is copying and might therefore copy a pointer without increasing the ref counter.