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: namespace std::


On Wed, 2004-08-04 at 20:09, Jonathan Wakely wrote:
> On Wed, Aug 04, 2004 at 08:06:39PM +0530, Dhruv Matani wrote:
> 
> > Hello,
> > 	I wanted to know whether:
> > 1. By including cstdlib I should get access to malloc() and free().
> > 2. Should malloc() and free() be in namespace std::?
> 
> Yes and yes.
> 
> i.e. this should compile fine (and does with GCC)
> 
>     #include <cstdlib>
>     int main()
>     {
>         std::free(std::malloc(1));
>     }

Unfortunately, even this does, which shouldn't:

#include <cstdlib>
int main()
{
  free(malloc(1));
}



-- 
        -Dhruv Matani.
http://www.geocities.com/dhruvbird/

The price of freedom is responsibility, but it's a bargain, because
freedom is priceless. ~ Hugh Downs


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