4 ms·
The null code point? That would be pedantic even by my standards.
by MathMonkeyMan 2y ago
The null code point? That would be pedantic even by my standards.
- saagarjha 2y agoLook I had to include it or someone is going to do a whole pedantic comment about how C can’t actually represent UTF-8 correctly
- pdpi 2y agoBy that metric, C can't represent ASCII correctly either, because there's no particular reason you couldn't have a NUL character somewhere inside a string.
- TeMPOraL 2y agoIndeed it can't. Many developers were bitten by this, and still are; plenty of critical bugs and security vulnerabilities rely on this quirk too.
- Sebb767 2y agoActually, by just alluding to the bug without saying it explicitly, you managed to both be pedantic and not avoid the discussion. This is not meant as a personal attack; I just want to point out how it looks on a casual reading :)
- saagarjha 2y agoWell, I'm not perfect ;)
- kstenerud 2y agoYou could have just said it rather than going through this smug "I know something you don't know!" song and dance. Also, by this rationale, NO string is ever safe in C, because pretty much every encoding technically supports codepoint 0 (even though you take your life into your hands should you ever use it). This is not a useful discussion.
- saagarjha 2y agoI mean strings that don't use that codepoint are fine, and that's most strings as I mentioned above.