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 to libstc++: Remove strdup from locale_facets.tcc


> 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


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