Note to self: memcpy(p, NULL,0) actually corrupts your memory, sometimes, on some machines. cc @johnregehr
-
-
Replying to @lemire @johnregehr
Whoa. Someone actually wrote an implementation that does something bonkers in this case? AND THE SYSTEM CAN BOOT?!
2 replies 0 retweets 4 likes -
Replying to @stephentyrone @lemire
this is on my shortlist of stupidest UBs
1 reply 0 retweets 3 likes -
Replying to @johnregehr @lemire
So the thing is that if you instrument memcpy, you will find that a *shocking* portion of memcpy calls have zero length (10-15% IIRC). It's exceedingly difficult to make this case do anything except the apparent "right" thing and have a usable system.
4 replies 4 retweets 6 likes
Zero length memcpy is defined/valid as long as src and dest pointers are. It's only UB with an invalid pointer.
3:44 PM - 18 Jul 2018
0 replies
0 retweets
0 likes
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.