Mail Archives: djgpp/1998/06/08/22:06:21
> 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 -