Why is this code accepted?
Alexandre Oliva
aoliva@redhat.com
Mon Apr 16 20:16:00 GMT 2001
On Apr 16, 2001, Mike Stump <mrs@windriver.com> wrote:
>> To: gcc@gcc.gnu.org
>> From: nbecker@fred.net
>> Date: 16 Apr 2001 16:27:42 -0400
>> This code compiles without complaint both on gcc-2.96 and on a
>> recent gcc-3 snapshot, but doesn't link. I suspect the
>> initialization of the static "a" is invalid (I don't have a good
>> reference handy), but isn't gcc behaviour wrong?
> There was a g++ feature that allowed this to work, a while ago.
> Someone broke that feature, and didn't remove the feature from all
> places in the compiler that supported the feature. As I recall, the
> standard doesn't support this feature.
Anyway, even in the few cases in which it does allow a static const
data member to be initialized inside the class body, it still requires
the data member to be defined outside the class body, which would
probably have got you around the problem.
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist *Please* write to mailing lists, not to me
More information about the Gcc
mailing list