[Lldb-commits] [lldb] r230046 - Add an OptionValueLanguage class
Joerg Sonnenberger
joerg at britannica.bec.de
Mon Feb 23 13:45:55 PST 2015
On Mon, Feb 23, 2015 at 05:31:50PM +0000, Zachary Turner wrote:
> How so? Suppose you've got a function which takes a const char*. Obviously
> it's null terminated or your function wouldn't be able to work. If you
> replace that with a StringRef it's still null terminated because the call
> site hasn't changed. Either way, its up to the caller to pass something
> null terminated.
>
> Any time you construct a StringRef from a std::string or ConstString, which
> is very close to 100% of what we do, the StringRef is guaranteed to be null
> terminated.
But StringRef is normally a part of either a std::string or const char *.
While there might be a null byte somewhere, it has no relation to the
size of the string referenced by StringRef. The point is that accessing
the data of a StringRef doesn't give a null terminated string of the
same size as the StringRef, if at all.
Joerg
More information about the lldb-commits
mailing list