4 ms·
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
by Athas 8y ago
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?
- adrianN 8y agoYes. Check here for a discussion: https://blog.regehr.org/archives/959 https://blog.regehr.org/archives/959
- gpderetta 8y agoEverything 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.