|
Boost : |
From: Eric Niebler (eric_at_[hidden])
Date: 2007-06-14 16:56:24
David Abrahams wrote:
> on Thu Jun 14 2007, Eric Niebler <eric-AT-boost-consulting.com> wrote:
>
>> template<typename T> struct static_const
>> {
>> static T const value;
>> };
>>
>> template<typename T>
>> T const static_const<T>::value = {};
>>
>> struct placeholder {};
>>
>> // This is *supposed* to be statically initialized but many
>> // compilers do dynamic initialization for it. :-(
>> placeholder const &_1 = static_const<placeholder>::value;
>
> I thought it was just MSVC. Any others?
Shoot, now I can't remember. How many did we test? Well, this much is
certain, there is at least one compiler that does dynamic initialization
for it. :-/
I also seem to recall that there was still some question as to whether
the use of the reference violated the ODR, if the reference is not
optimized away. I don't think we ever got an answer to that question.
-- Eric Niebler Boost Consulting www.boost-consulting.com The Astoria Seminar ==> http://www.astoriaseminar.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk