Re: Accessing file-scope variable from shared library ctor

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

 



On Mon, Jun 3, 2013 at 11:01 AM, Andy Falanga (afalanga)
<afalanga@xxxxxxxxxx> wrote:

> I have one question further.  I tried using this approach because of what I read in the GCC manuals, "Functions with these attributes are useful for initializing data that is used implicitly during the execution of the program. (taken from http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html)"  I wish only to understand more fully, if initialization of data, as in this case, is so problematic, why is it such a good thing?  Is it because my data variable wasn't truly global, but instead translation-unit-only?  What am I missing from what the manual is describing?
>
The C/C++ languages do not guarantee order of initialization. If
translation unit A needs a static global from translation unit B,
there's no guarantee that B's static variable will be initialized
before A's use of it.

Jeff





[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