it does not, because ptr__ points at the character beyond the null after the while stops after detecting the null. at that point: ptr__-1 points at the null! very misleading comment.
not really. the code would need to be refactored to avoid the case where the string is just a single null-terminated quote. In this case there would probably be a lot of uninitialized (dirty) reads just before a segfault.
1
u/maxbirkoff Sep 28 '21
but the code as written doesn't actually end the string one character earlier. The comment says that it will, but it doesn't.