This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [MAC] 'static const std::string' in a header file


On Jan 8, 2005, at 3:42 PM, Mathieu Malaterre wrote:

Hello,

I am working on a cross plateform DICOM lib which seems to be working fairly well on a variety of plateforms except on MacOSX with gcc.

If I try to run any example it gets stuck on a string construction. I believe this has to do with multi thread and c++ object initialization on the Mac. Could someone comment on the usage in a header file of:

static const std::string foo = "bar";

Is this a bad practice ? Can it be safely replace by something else that would be more 'conventional/robust' ? BTW I cannot change this to a regular 'const char foo[]' since I am returning direct const reference to this object.

I include the gdb backtrace, hopefully this should mean something for someone :)

This looks to me like a known bug in the way that file-scope objects in dylibs get initialized. It will be fixed in Tiger.


--Matt


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]