[PATCH] A new ADT: StringRefNulTerminated

Krzysztof Parzyszek kparzysz at codeaurora.org
Sat Feb 23 15:37:58 PST 2013


On 2/23/2013 5:30 PM, Dmitri Gribenko wrote:
>
> This raises a more important question: should we state that
> StringRefNulTerminated::c_str() != NULL and include an assertion in
> the 'const char*' constructor?

I think this requirement would follow the Principle of Least 
Astonishment.  Empty StringRef may have some meaning, as it's not 
unreasonable to consider a character string with zero characters.  On 
the other hand, StringRefNulTerminated with c_str() being NULL doesn't 
represent anything useful.

-Krzysztof

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, 
hosted by The Linux Foundation



More information about the llvm-commits mailing list