|
Boost : |
From: Gennaro Prota (gennaro_prota_at_[hidden])
Date: 2003-01-07 20:27:55
On Wed, 8 Jan 2003 01:23:05 +0100, Terje Slettebø
<tslettebo_at_[hidden]> wrote:
>>From: "Gennaro Prota" <gennaro_prota_at_[hidden]>
>> It *may* need out-of-class definition, as you say.
>
>Actually, it's pretty clear that in this case, the out-of-class definition
>is required.
Indeed.
> Intel C++ 7.0, running in strict mode, certainly needs it. It
>gives a link-error without it, for the program I gave. GCC 3.2 gives a
>link-error, as well.
>
>> This could also be a boost FAQ ;-)
>> http://lists.boost.org/MailArchives/boost/msg35797.php
>
>I am well aware of the DR that allows static const in-class initialisation
>to omit having an external definition (I read that DR item, earlier _today_,
>:) as I was browsing through the list), and I've also read that posting,
>earlier, so this was nothing new to me. Don't you think I know this? :)
Sure you do. It's just that being a little tired (it's 2.00 AM here) I
didn't read your whole post. Of course this means that I shouldn't
have replied, but my intent was to be useful, by pointing out the DR.
Sorry. BTW I've seen that compilers tend to not follow the new wording
of 3.2 literally. For instance with most compilers I guess this
compiles fine thanks to the conversion to rvalue made by static_cast
struct Test
{
static const int value=1 ;
};
//const int Test::value;
void f(const int &)
{
}
int main()
{
f( static_cast<int> (Test::value) );
}
despite the fact that the expression Test::value is, as far as I
understand the standard, potentially evaluated. I think this is more a
problem in the standard than in the compilers though, because this
behavior appears natural to me.
Genny.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk