News for hackers. Stuff that matters.
Re:Linus Torvalds on aliasing by Athas on Friday June 08, 2018 @03:33AM (#17263359)
Does this mean that memcpy() is really more of a language construct than a library function, since it cannot be implemented correctly in fully defined standard C?
Re:Linus Torvalds on aliasing by adrianN on Friday June 08, 2018 @03:43AM (#17263418)
Yes. Check here for a discussion: https://blog.regehr.org/archives/959
Re:Linus Torvalds on aliasing by gpderetta on Friday June 08, 2018 @05:18AM (#17263796)
Everything defined in the standard is in principle a language construct: whether it is builtin in the compiler or an actual function is an implementation detail. For many compilers, memcpy is both: they have builtin handling for it but fall back to the library implementation when there is no optimization opportunities.

Having said that, it is possible to implement memcopy in standard C: char pointers have an explicit special exemption to the aliasing rule so you are allowed to inspect objects as array of chars.