www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/06/08/22:06:21

Date: Mon, 8 Jun 1998 22:04:41 -0400 (EDT)
Message-Id: <199806090204.WAA20952@delorie.com>
From: DJ Delorie <dj AT delorie DOT com>
To: sparhawk AT eunet DOT at
CC: djgpp AT delorie DOT com
In-reply-to: <357c0c3a.24494159@news.Austria.EU.net> (sparhawk@eunet.at)
Subject: Re: How big can I make my array?

> I heard this a number of times but I don't see any advantage or disadvantage.
> When I allocate i.e. a string (like char *x = malloc(n)) I don't see the
> reason why I should use new instead of malloc(). Is there a drawback to
> malloc()?

For simple types like strings or arrays of integer, you won't notice
much difference (in fact, new calls malloc in djgpp).  However, for
complex types, new calls the object's constructor but malloc does not.

Also, new handles the out-of-memory event different than malloc.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019