bug-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Static class member initialization buggy?


From: Johnny Wezel
Subject: Re: Static class member initialization buggy?
Date: 17 Dec 2001 01:27:55 -0800

address@hidden (Thomas Maeder) wrote in message news:<address@hidden>...
> Johnny Wezel wrote:
> 
> > x.h:
> > ====
> > class X {
> >   ...
> >   static short type;
> > }
> > 
> > x.cc:
> > =====
> > 
> > short X::type = nextType++;
> 
> 
> How do you make sure that nextType is initialized before X::type?

IMHO a simple short int should be initialized by the linker, whereas a
dynamic initialization should be done at runtime, so nextType should
already be initialized before the program runs.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]