Re:Why is strlen so complex in C?
by saagarjha on Tuesday August 27, 2019 @11:23AM
(#20810559)
What? C++ strings have an overhead of 16 bytes+the space left in the backing buffer. That’s really not all that much.
[ Parent
| on HN ]
Re:Why is strlen so complex in C?
by compiler-guy on Tuesday August 27, 2019 @04:51PM
(#20814305)
16 bytes is in no way guaranteed by the standard.
Of course–the implementation is free to do whatever it likes. But all reasonable ones will either use a three pointer (or some combination of a base pointer and pointers/integers representation bounds) or include a small buffer for SSO that overlaps with the storage for heap bounds.