On Mon, Sep 13, 2010 at 5:03 PM, Torsten Dreyer <[email protected]> wrote:
>     Hi all,
>
> the new METAR handler uses the following code
>
> static const string coverage_string[] = {
>   SGCloudLayer::SG_CLOUD_CLEAR_STRING,
>
> Does anybody else see this? Is a static string array a bad idea?

Looks like initialization order problem. I guess the static strings
themselves have not been constructed yet when the array tries to copy
them. You could check that from a debugger. The compiler should have
generated proper order, assuming there are no circular dependencies.
For me, on linux, the initializers run in the expected order:

(gdb) br cloud.cxx:86
Breakpoint 1 at 0xa489f7: file simgear/scene/sky/cloud.cxx, line 86.
(gdb) br metarproperties.cxx:99
Breakpoint 2 at 0xa37350: file src/Environment/metarproperties.cxx,
line 99. (2 locations)
(gdb) r
Starting program: src/Main/fgfs
[Thread debugging using libthread_db enabled]
[New Thread 0x7f705f8d8700 (LWP 9660)]
[Switching to Thread 0x7f705f8d8700 (LWP 9660)]

Breakpoint 1, __static_initialization_and_destruction_0
(__initialize_p=1, __priority=65535)
    at simgear/scene/sky/cloud.cxx:86
86      const std::string SGCloudLayer::SG_CLOUD_OVERCAST_STRING = "overcast";
(gdb) c
Continuing.

Breakpoint 2, __static_initialization_and_destruction_0
(__initialize_p=1, __priority=65535)
    at src/Environment/metarproperties.cxx:99
99      static const string coverage_string[] = {

-- 
Csaba/Jester

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Flightgear-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to