This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ 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: C++ io, thread safety, and setlocale


Loren James Rittle:
> >I'm still trying to understand why I only have problems on aix and not on
> >linux and solaris.
> 
> Without completely knowledge of the libc implementation I could only
> guess.  It is possible that Solaris and glibc implement setlocale
> in a manner like FreeBSD where "C" -> "C" is a stable change
> w.r.t. other threads in the process.  It is possible that "C"
> is your default locale in all those environments.
> 
> It is possible that AIX implements a non-stable setlocale (that
> isn't a bug in their libc since the standard says nothing
> about this).  It is possible that you have a non-"C" locale
> in your AIX environment.
> 

You are right. My linux box and solaris have a "stable" setlocale.  Even
after:

    setlocale(LC_ALL,"C");
    char* l1 = setlocale(LC_ALL,0);
    setlocale(LC_ALL,"C");
    char* l2 = setlocale(LC_ALL,strdup(l1));    // Note the strdup

l1 == l2.  AIX fails this test.  I suppose this explains a lot.

Benjamin suggests moving to gcc-3.3 soon which sounds good.  In the meantime,
I think I'll just murder the setlocale's in the generic code.


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