Re: Reasonable static initialization assurance

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

 



> 1. Your question is of general nature not specific to gcc.  As such it doesn't
> belong onto the gcc-help list.

You're telling me that the compiler plays no part in the variable
initializations?

2.  I'm trying to find the difference between the code specifically. 
It also currently only happens on OSX gcc and not linux.  Perhaps I
can reproduce in linux, but as I've finally tracked the error down to
a std::string object being assigned to during another part of the
static initialization period I'm sure that case has happened before.

> 3. Static values are contained in the program text at any execution time and
> are loaded into their own memory section never changing their place.

Yes of course, exactly.  I'm asking if there is any "reasonable" way
to use non-POD types for static global variables and use them before
the initalization period is over.

Of course, you can replace objects like std::string with character
arrays -- but the question still remains.

> I assume you access not initialized contents of the variables or you write
> into const sections of constant values.

Well, even without an assignment made.  Just a non-POD object sitting
in memory initialized properly.

Corey


[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