Boost logo

Boost :

From: Bryan Ross (bross_at_[hidden])
Date: 2002-08-22 19:59:54


>-----Original Message-----
>From: Maxim Shemanarev [mailto:mcseem_at_[hidden]]
>Sent: Thursday, August 22, 2002 5:30 PM
>To: boost_at_[hidden]
>Subject: [boost] Re: Misc Borland problems
>
>
>> After testing, I found that anything like
>>
>> template <class T>
>> struct X
>> {
>> static T& f();
>> static const int value = sizeof(f());
>> };
>>

I might not be getting something, but isn't X<T>::f() a function
declaration? And wouldn't value be initialized with the sizeof a
pointer?
At least, that's what I got on VC7 just now :\

>> will not compile, whether or not instantiated.
>
>I believe it's because of the the new C++ innovation of having static
const int members initialized *inside* the class. Apparently Borland
simply doesn't >support this IMO useless feature. Can anyone tell me
what's the good of it when one can perfetly use enums? Let alone it's
clearly said that this syntax >is applicable for only integer types.
Historically there's the rule in C and C++ that the initialization can
be done only in the definition, but not in
>the declaration. This innovation breakes this rule. Although, it can
seem that enums are also exceptions, but in fact, in enums there's no
definition and >no intialization. There's only a declaration.
>
>I would vote for changing these things to enums.
>
>McSeem
>_______________________________________________
>Unsubscribe & other changes:
http://lists.boost.org/mailman/listinfo.cgi/boost

Bryan Ross
bross_at_[hidden]


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk