Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| Message-ID | <baddfb0e-750a-412a-afad-fa6b944ff04b@f31g2000pri.googlegroups.com> (permalink) |
|---|---|
| Newsgroups | comp.std.c++ |
| From | aakash <asharma.com@gmail.com> |
| Subject | static variable initialization order |
| Organization | http://groups.google.com |
| Date | 2011-04-23 13:34 -0600 |
struct Base
{
static int x;
}
int Base::x = 1;
and in file b.hpp, we have a struct
struct Derived: Base
{
static int y;
}
int Derived::y = 2;
Is it guaranteed that when we compile these two class file, static
variable x will be initialized before static variable y?
I know that initialization of static variables are not defined, but
since x is in a base class, will it be first initialized?
--
[ comp.std.c++ is moderated. To submit articles, try posting with your ]
[ newsreader. If that fails, use mailto:std-cpp-submit@vandevoorde.com ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]
Back to comp.std.c++ | Previous | Next — Next in thread | Find similar | Unroll thread
static variable initialization order aakash <asharma.com@gmail.com> - 2011-04-23 13:34 -0600 Re: static variable initialization order Daniel Krügler <daniel.kruegler@googlemail.com> - 2011-04-24 09:53 -0600
csiph-web