On Tue, Sep 20, 2016 at 2:51 PM Greg Clayton <gclay...@apple.com> wrote:

> > On Sep 20, 2016, at 2:49 PM, Mehdi Amini <mehdi.am...@apple.com> wrote:
> >
> >
> >> On Sep 20, 2016, at 2:46 PM, Zachary Turner <ztur...@google.com> wrote:
> >>
> >> Occasionally (and in my experience *very* occasionally), you need to
> treat "" as different from null.
> doesn't StringRef store an actual pointer to ""? This would mean
> StringRef::data() would return non null, but StringRef::size() would return
> 0. So I believe that isn't a problem with StringRef

Right, it's only a problem when you need to write a function that returns
or accepts a string, and null has to be treated differently than empty.  As
Mehdi said, one option is an Optional<StringRef>, although I admit that
there are times where pointers would still be more convenient.  They're
still used in some places in llvm and clang for example, just not nearly as
often as StringRef.
lldb-dev mailing list

Reply via email to