[cfe-commits] r148374 - in /cfe/trunk: lib/AST/ExprConstant.cpp test/SemaCXX/constexpr-strlen.cpp

Matthieu Monrocq matthieu.monrocq at gmail.com
Thu Jan 19 11:30:32 PST 2012


Le 19 janvier 2012 17:52, Jonathan Sauer <jonathan.sauer at gmx.de> a écrit :

> >> Do you know if the same apply (I would guess so) to std::strlen ?
> >>
> >> It seems a pity that such a trivial function could not be constexpr as
> making it constexpr is actually dead simple. I wonder if it would be worth
> a Defect Report.
> >>
> > This would seem very reasonable to me...
>
> As well as a lot (all?) of the math functions in cmath. And clang's
> built-ins (__builtin_sin etc), too.
>
>
> What do you think?
> Jonathan
>

I haven't followed the C11 proposal, is the "constexpr" idea addressed
there or would it be a specific C++ issue ?

C++ imports a massive amount of C functions, and keeping their signature
as-is will be a hindrance, I don't fancy the idea of recoding them all in
pure C++ to allow such optimizations! It seems like at least the `std::`
versions could be made `constexpr` when possible.

I am putting Howard in copy since this seems something libc++ would be
interested in, and perhaps his C++ committee experience could help us here.

-- Matthieu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120119/43b072a9/attachment.html>


More information about the cfe-commits mailing list