constant static public attributes

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

 



Hi, I'm having problems creating constant static public attributes which depend on other objects of the same kind. The situation is:

-- color.h ---
class color {
[...]
   static const color WHITE;
}
------
#include "color.h"
-- color.cpp ---
const color color::WHITE(255,255,255);
[...]
------
color.o is generated by "g++ -o color.o -c color.cpp"
-- light.h ---
#include "color.h"
class light {
[...]
   static const light SUN;
}
------
-- light.cpp ---
#include "light.h"
const light light::SUN(..., color::WHITE); // the color of SUN is WHITE
[...]
------
light.o is generated by "g++ -o light.o -c light.cpp"

The application is generated by "g++ color.o light.o main.o -o application", but inside the application, the color of the SUN is not WHITE.

Is guess this is because code is generated such that the SUN is initialized before WHITE is initialized...
Suggestions? Advice?


--
Bruno de Oliveira Schneider
bruno_schneider@xxxxxxxxxxx

_________________________________________________________________
MSN Messenger: instale grátis e converse com seus amigos. http://messenger.msn.com.br



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux