News for hackers. Stuff that matters.
Re:GCC 6.1 Released by astrange on Thursday April 28, 2016 @04:16AM (#11587211)
> Functions like memcpy or malloc cannot legally be written in C without breaking this behavior

> Also not true.

You cannot implement malloc in C because malloc always returns a pointer that's not a part of an existing allocation. The malloc in libc has special dispensation from the compiler to do this (GCC "malloc" attribute).

Similarly you can't implement pthread mutexes in C because they imply optimization barriers (all global memory might change) that a C function with a visible implementation wouldn't have.

Re:GCC 6.1 Released by dsfuoi on Thursday April 28, 2016 @04:38AM (#11587292)
You can easily implement malloc. I don't understand what relevance with this your paragraph has.

C11 has atomics and all the necessary primitives, fences, locking, etc..., to implement pthread_mutex, including its own mutex.