malloc_allocator.h

Paolo Carlini pcarlini@suse.de
Thu Dec 9 19:06:00 GMT 2004


Matt Austern wrote:

> Possibly stupid question...  malloc_allocator is defined in namespace 
> __gnu_cxx, but it makes use of the names size_t, ptrdiff_t, malloc, 
> and free, without qualification.  How can this be right?  Shouldn't 
> they be std-qualified?

Well, this happens not only for malloc_allocator, but for *all* our 
allocators. And, as long as <cstdlib> is included (Rth fixed this 
recently exactly for malloc_allocator, are you alluding to that, 
specific, problem?) everything ""works"" because, unfortunately, our C 
headers still inject the names in the global namespace too.

We could easily qualify those names but the real problem with the C 
headers will not be fixed very soon, AFAIK, seems very difficult to get 
it right without controlling the libc, others know the technical details 
of this much better than me.

Paolo.



More information about the Libstdc++ mailing list