malloc_allocator.h
Matt Austern
austern@apple.com
Thu Dec 9 19:13:00 GMT 2004
On Dec 9, 2004, at 11:07 AM, Paolo Carlini wrote:
> 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?)
Yes and no. That specific problem is the reason I was looking at
malloc_allocator.h in the first place, yes. I noticed the std
qualification issue along the way.
> 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.
OK, that's fair enough. I guess I was under the mistaken impression
that on some systems we did get C library names in namespace std only
when we included the <c...> form of the header. I was afraid this
might be one of these cases where things are fine on popular systems
like linux and darwin but horribly broken somewhere else.
--Matt
More information about the Libstdc++
mailing list