This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [MAC] 'static const std::string' in a header file
- From: Matt Austern <austern at apple dot com>
- To: Mathieu Malaterre <mmalater at nycap dot rr dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Sat, 8 Jan 2005 17:49:57 -0800
- Subject: Re: [MAC] 'static const std::string' in a header file
- References: <41E06FE9.4030601@nycap.rr.com>
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