From: DeMarcus on
Hi,

As the standard now defines multi-threading, is there anything said
about the initialization of global variables? I.e. will a compiler be
allowed to initialize global data in parallel?


Thanks,
Daniel

--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

From: Anthony Williams on
DeMarcus <use_my_alias_here(a)hotmail.com> writes:

> As the standard now defines multi-threading, is there anything said
> about the initialization of global variables? I.e. will a compiler be
> allowed to initialize global data in parallel?

Yes. This is allowed by 3.6.2p2 in the FCD.

The compiler still has to obey the ordering requirements. For example,
within a single translation unit objects with static storage duration
must be initialized in order of definition.

Anthony
--
Author of C++ Concurrency in Action http://www.stdthread.co.uk/book/
just::thread C++0x thread library http://www.stdthread.co.uk
Just Software Solutions Ltd http://www.justsoftwaresolutions.co.uk
15 Carrallack Mews, St Just, Cornwall, TR19 7UL, UK. Company No. 5478976

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]