3 ms·
I would make a less-strict statement that "Undefined behavior should be reserved for cases where there might be some advantage for an implementation to do it a
by bodyfour 12y ago
I would make a less-strict statement that "Undefined behavior should be reserved for cases where there might be some advantage for an implementation to do it a different way."
For memcpy it's never safe for it to access the byte at "src+len" (it could be past the end of mapped memory) nor is it safe to write to "dest+len" So if len==0 it should follow that it won't access either src[0] or dest[0].
The spec basically allows len==0 to be a special case for this rule, although it's not clear what implementation would ever be able to take advantage of that.