I've always thought that if you do #include <cheader> (where header is some standard c++ header like stdio/stdlib/string), it is the same that #include <header.h>, but wrapped into the std namespace. How does that code snippet compiles then (g++ 4.7.3)?
#include <cstdlib>
int main()
{
    malloc(1);
    return 0;
}
Why should one include <cstdio> then (instead of <stdio.h>) if standard C functions will be in the global namespace anyway?
And the second question is — what should I do to get some of these functions out of the global namespace (while using c++ headers at the same time)? For instance, I don't want malloc to be in the global namespace since I have a home assignment : to write my own memory allocator (in particular, malloc and free functions) which I will compile into dynamic library and plug into any program using LD_PRELOAD.