www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/03/03/13:54:36

From: gfoot AT mc31 DOT merton DOT ox DOT ac DOT uk (George Foot)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: DJGPP Structs
Date: 3 Mar 1997 16:57:11 GMT
Organization: Oxford University
Lines: 19
Message-ID: <5fevt7$qpj@news.ox.ac.uk>
References: <01bc2673$a4dbe420$8e54dec2 AT satan> <5fdmdn$mn8 AT freenet-news DOT carleton DOT ca>
NNTP-Posting-Host: mc31.merton.ox.ac.uk
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Paul Derbyshire (ao950 AT FreeNet DOT Carleton DOT CA) wrote:

: Also: no typecast is needed to assign the result of a malloc or calloc to
: a pointer.

: int *bunch_of_ints;
: bunch_of_ints=malloc (3000*sizeof(int));

: will work just as well as 

: int *bunch_of_ints;
: bunch_of_ints=(int *)malloc (3000*sizeof(int));

Not quite true. Both work equally well in (non-ANSI) C, but only the latter
is compliant with ANSI C regulations (and hence C++).

-- 
George Foot <gfoot AT mc31 DOT merton DOT ox DOT ac DOT uk>
Merton College, Oxford.

- Raw text -


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