4 ms·
Something feels wrong about using memccpy to copy strings... ever since I saw bugs where people used memcpy incorrectly. And is there a wchar_t version of memc
by Tempest1981 5y ago
Something feels wrong about using memccpy to copy strings... ever since I saw bugs where people used memcpy incorrectly.
And is there a wchar_t version of memccpy?
- saagarjha 5y agomemccpy≠memcpy, even though their names are similar. While the function is somewhat generic, I would bet 90+% of its use is going to be to copy null-terminated strings.
- Tempest1981 5y agoRight, maybe I'm just reacting to the name. I've had to educate many novices about using memcpy with incorrect lengths... either 1 short (no null), or even sizeof(src) and wondering why only 4 or 8 bytes got copied. Now if I steer them to hot new memccpy, they may hear "memcpy" and run off: "memcpy? Sure, I know that!"