delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/05/28/16:52:05

From: Martin Read <mpr22 AT cam DOT ac DOT uk>
Newsgroups: rec.games.design,alt.msdos.programmer,comp.os.msdos.djgpp,rec.games.programmer
Subject: Re: C or C++
Date: 28 May 1997 19:13:41 GMT
Organization: Caius College, Cambridge
Message-ID: <5mi055$37p@lyra.csx.cam.ac.uk>
References: <5lrt2d$qun AT bambam DOT soi DOT city DOT ac DOT uk> <5mftso$2nc AT butch DOT lmms DOT lmco DOT com> <338C31B9 DOT 3146 AT ll DOT mit DOT edu>
NNTP-Posting-Host: talisa.acad.cai.cam.ac.uk
Originator: mpr22 AT talisa DOT acad DOT cai DOT cam DOT ac DOT uk
Lines: 16
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

In article <338C31B9 DOT 3146 AT ll DOT mit DOT edu>, Nathan Gray  <gray AT ll DOT mit DOT edu> wrote:
>Since we're on the subject of C and C++, does anyone have a good
>explanation for the differences between malloc() and new?  As a native
>C++ programmer, my first instinct is to use new, but I see malloc() so
>often I'm starting to wonder if I'm missing something.

new is an operator, which can be custom-defined for a class so that it
can do lots of clever things (IIRC).  malloc() just says "I want a piece
of memory of size wibble; give me a pointer to the start of it."

Martin
-- 
Martin Read, Caius College, Cambridge, CB2 1TA
\_V_/ | gimme the ring/kiss'd and toil'd/give me something that i missed
 \ /  |     -- AE, "This Corrosion"
  V   |

- Raw text -


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