[Lldb-commits] [lldb] r230046 - Add an OptionValueLanguage class

Zachary Turner zturner at google.com
Mon Feb 23 09:31:50 PST 2015


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.

That said, in Pavels first response i missed the part where he said "or
even better change the receiving function to work with a StringRef ". I
agree that's better.
On Mon, Feb 23, 2015 at 9:22 AM Joerg Sonnenberger <joerg at britannica.bec.de>
wrote:

> On Mon, Feb 23, 2015 at 04:01:53PM +0000, Zachary Turner wrote:
> > No we don't. A const char* is not guaranteed to be null terminated
> either.
> > Its up to you to make sure you pass it a null terminated string. Same
> > applies here.
>
> I don't understand your point. StringRef is pretty much guaranteed to
> not be null terminated, at least not at the right place.
>
> Joerg
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150223/e469bd2b/attachment.html>


More information about the lldb-commits mailing list