4 ms·
Actually, it's to allow for non-NUL terminated strings. A good example is when using a String supplied by a scripting language such as Ruby or JavaScript. Nor
by bowild 8y ago
Actually, it's to allow for non-NUL terminated strings.
A good example is when using a String supplied by a scripting language such as Ruby or JavaScript.
Normally, you might need to copy the string to add a NUL byte, or request that the scripting engine provide a NUL terminated string (which might result in the same action performed).
Using this optional approach, a potential copy of the data can be avoided.