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: PATCH: Tweak 22_locale to hide more "expected errors"


 > From: Ulrich Drepper <drepper at redhat dot com>
 > 
 > Loren James Rittle wrote:
 > 
 > > Now, a basic improvement might be to support putenv() when it is
 > > available and setenv() was not available (Kaveh wrote that putenv() is
 > > more portable;
 > 
 > Using putenv() is almost always wrong.  Read the specs of the function.
 >  The string passes as the argument is added to the environment.  Not a
 > copy, the string itself.  If the string is allocated on the stack the
 > frame mustn't be left.  If it's dynamically allocated the memory might
 > leak when the entry gets replaced.
 > 
 > Use setenv() and ignore this bad advise.

This is a red herring.  We're talking about what to do when setenv is
not available.

--
Kaveh R. Ghazi			ghazi at caip dot rutgers dot edu


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