[cfe-commits] [Patch][Review] constexpr-ification of <limits> and random number generators

Jonathan Sauer jonathan.sauer at gmx.de
Sun Apr 1 23:44:19 PDT 2012


Hello,

> [...]
> That's a good argument, thanks.  I guess I'm now favoring Richard's exact proposal:
> 
> #ifndef _LIBCPP_HAS_NO_CONSTEXPR
> #define _LIBCPP_CONSTEXPR constexpr
> #else
> #define _LIBCPP_CONSTEXPR
> #endif
> 
> Then use
> 
> _LIBCPP_CONSTEXPR const int n = 5;
> 
> for variables, and
> 
> struct S {
>  _LIBCPP_CONSTEXPR S();
>  _LIBCPP_CONSTEXPR int f() const;
> };
> 
> for functions.
> 
> I like it better than Jonathan's, and my first _CONSTEXPR_1, _CONSTEXPR_0 because of the single macro that is either going to be constexpr or not.  The source code won't be as compact, but I find it more readable (though just a little too verbose).
> 
> Jonathan, I really appreciate you're work in <limits> and <random> and sorry about thrashing you around on this issue.  But I felt it important to hammer this out before we get too invested in the wrong strategy, as we already are with my ill-fated:

Oh, no problem: First of all adapting my patch took me about 10 minutes, and second of all I did it on a whim,
so any unnecessary work done by me is my own fault :-)

I prepared a new patch using _LIBCPP_CONSTEXPR and have it attached. Please review and, if ok, commit.


With many thanks in advance,
Jonathan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: algo_limits_random.diff
Type: application/octet-stream
Size: 72186 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120402/062dcc4e/attachment.obj>
-------------- next part --------------




More information about the cfe-commits mailing list