This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Problem with putenv() in global constructor
- From: Loren James Rittle <rittle at latour dot rsch dot comm dot mot dot com>
- To: gcc-bugs at gcc dot gnu dot org
- Cc: gregory at il dot marvell dot com
- Date: Tue, 7 Jan 2003 10:33:08 -0600 (CST)
- Subject: Re: Problem with putenv() in global constructor
- Organization: Networks and Infrastructure Lab (IL02/2240), Motorola Labs
> I found some strange putenv() function behavior when it's used in a
> global object (C++ code) constructor. I work on SPARC/Solaris 8
> with g++/gcc version 2.95.3 20010315 (release). [...]
Hi,
This behavior is outside the scope of anything we can "fix" (unless we
break other global constuctor-related issues). Your report does not
suprise me. To be most portable, C++ programs should avoid global
constructors that will invoke library functions traditionally callable
only after main() has been invoked. The other known trouble spots: You
will find that some systems can't properly allocate any memory before
main() is invoked. Never attempt to start a POSIX thread before main().
Regards,
Loren