[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lmi] Don't initialize constexpr variable with std::ldexp()
From: |
Greg Chicares |
Subject: |
Re: [lmi] Don't initialize constexpr variable with std::ldexp() |
Date: |
Mon, 24 Apr 2017 16:37:55 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.6.0 |
On 2017-04-24 16:16, Vadim Zeitlin wrote:
> On Mon, 24 Apr 2017 15:25:48 +0000 Greg Chicares <address@hidden> wrote:
>
> GC> With this patch, does the 'bourn_cast_test.cpp' unit test compile and
> GC> report zero errors with these other two compilers?
>
> Yes, the test passes with both gcc and clang (and sorry, I meant to say
> this in my previous message but after rereading it I see that I forgot to
> include it).
I think you meant
- the test passes with both gcc and clang
+ the test passes with both msvc and clang
[...effect of const (not constexpr) with or without static...]
> This is true, but I expect the call to ldexp() to be very fast even if
> it's not evaluated at compile-time -- which should be the case with gcc.
> OTOH static variables must be MT-safe in C++11 and so using it here must
> involve at least an atomic variable access (or maybe even a mutex
> lock/unlock?), which could well be more expensive.
Interesting.
[...snip discussion...]
> GC> Is that your reasoning for suggesting s/static constexpr/static/g
> throughout
> GC> this header?
>
> I think the above is just a typo but, just to be sure, this is not what
> I'm suggesting: I'm rather suggesting "s/static constexpr/constexpr/g".
Yes, that's what I meant. I'll make that change today.