https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114088

--- Comment #5 from Thiago Macieira <thiago at kde dot org> ---
(In reply to Jonathan Wakely from comment #4)
> (In reply to Xi Ruoyao from comment #2)
> > But __builtin_strlen *does* get optimized when the input is a string
> > literal.
> 
> But so does strlen, because GCC knows about it. That's my point.

And if POSIX or ISO C had c16slen() and c32slen(), I might use them. But this
request would stand that you do implement built-ins for those.

They don't. Even if they did, I would not want to call them everywhere unless I
knew the compiler had an intrinsic to match and thus replace with a constant
value when the string is known to be constant. The code we currently have using
`std::char_traits<char16_t>::length()` would have a small regression in
performance if the compiler always inserted out-of-line calls.

Therefore, what really matters to me is that the compiler have an intrinsic.

Reply via email to