This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: Patch to libstc++: Remove strdup from locale_facets.tcc
- From: Loren James Rittle <rittle at latour dot rsch dot comm dot mot dot com>
- To: libstdc++ at gcc dot gnu dot org
- Date: Tue, 10 Sep 2002 22:31:40 -0500 (CDT)
- Subject: Re: Patch to libstc++: Remove strdup from locale_facets.tcc
- Organization: Networks and Infrastructure Lab (IL02/2240), Motorola Labs
- References: <20020909230558.46315.qmail@web14501.mail.yahoo.com>
> This is not a criticism of the patch but more of a philosophical
> question.
> Would it not be better to replace with the strdup call with a
> get_temporary_buffer and copy (or maybe strcpy)? While at the moment
> get_temporary_buffer is just a malloc call, some day it might be fixed
> to use a pooled allocator or some more thread-friendly scheme, or
> perhaps use new instead of malloc?
I think yes on all counts.
> Is there in fact any guiding policy on non-Allocator memory allocation
> within libstdc++?
None documented AFAIK. If the allocator abstraction is good enough
for traditional STL and string<>, then why should it not be used
everywhere within libstdc++-v3?
> Should there be, in an effort to be thread-friendly
The malloc/free pairs should itself be thread-friendly on any system
that claims to have a thread-friendly libc.
> and consistent in the presence of exceptions?
Yes, the naked malloc/free pair clearly fails on this point unless one
is quite careful.
Regards,
Loren