4 ms·
I feel like this person went through an unnecessary and false tangent about how people are "afraid" of memcpy due to inexperience and missed the much more impor
by asveikau 2y ago
I feel like this person went through an unnecessary and false tangent about how people are "afraid" of memcpy due to inexperience and missed the much more important criticism that arbitrary, naive truncation on a byte level doesn't play well with Unicode.
- aflag 2y agoDo the str* functions handle Unicode any better though? I feel like you'd want a different library for that
- ben_bai 2y agothat would be wcslcpy(3)
- asveikau 2y agoNope. Unicode correctness is much more complicated than switching char to wchar_t. Many glyphs take multiple codepoints or multiple character units in either utf-16 or utf-8. You need something like the break iterator "character" separator in ICU.