[PATCH] A new ADT: StringRefNulTerminated

Dmitri Gribenko gribozavr at gmail.com
Sat Feb 23 14:58:28 PST 2013


On Thu, Feb 21, 2013 at 9:57 AM, Evgeniy Stepanov
<eugeni.stepanov at gmail.com> wrote:
>> explicit StringRefNulTerminated(const char *Str) : StringRef(Str) {}
>
> Why is this explicit, and the same constructor of StringRef is not?

I should have explained that in the first post.  As I just wrote in
other message, I wanted to have an implicit conversion from a string
literal, but not from any 'const char *' pointer, since it is not
uncommon in LLVM to sometimes have a 'const char *' that is not
NUL-terminated -- that you just fetched from a StringRef, or that
would be put in a StringRef on the next lines.

Thank you for the review!

Dmitri

-- 
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/



More information about the llvm-commits mailing list