[cfe-dev] What is the StringRef equivalent of NULL?
Chris Lattner
clattner at apple.com
Tue Aug 17 11:44:24 PDT 2010
On Aug 17, 2010, at 11:38 AM, Peter Davies wrote:
>>> So why does StringRef(NULL) segfault?
>>
>> IIRC, because it calls strlen(NULL).
>
> To better phrase the question, why doesn't it check and return
> StringRef() in that case?
Because that constructor is specified to take a non-null pointer :). It is a hot method and doing the null check would be wasteful.
-Chris
More information about the cfe-dev
mailing list