[cfe-commits] libc++ and const expr.
Joerg Sonnenberger
joerg at britannica.bec.de
Sat Feb 4 11:45:43 PST 2012
On Sat, Feb 04, 2012 at 11:41:38AM -0800, Eli Friedman wrote:
> On Sat, Feb 4, 2012 at 11:27 AM, Joerg Sonnenberger
> <joerg at britannica.bec.de> wrote:
> > On Sat, Feb 04, 2012 at 11:53:28AM -0500, Howard Hinnant wrote:
> >> But I note the crux of this issue appears to be that this:
> >>
> >> static const intmax_t nan = (1LL << (sizeof(intmax_t) * CHAR_BIT - 1));
> >>
> >> is no longer consider a compile time constant expression.
> >
> > Ignoring the question of whether clang should allow that or not, why
> > aren't you using the more compact statement below, which is just as
> > portable:
> >
> > static const intmax_t -~(intmax_t)0;
>
> -~0 is 1, not INT_MIN.
Bah right. But what about using INT_MIN etc? It's not like it doesn't
already depend on CHAR_BIT to be present.
Joerg
More information about the cfe-commits
mailing list