From: Erik Max Francis Newsgroups: comp.os.msdos.djgpp Subject: Re: DJGPP Structs Date: Mon, 03 Mar 1997 00:05:27 -0800 Organization: Alcyone Systems Lines: 25 Message-ID: <331A8647.65FFF76F@alcyone.com> References: <01bc2673$a4dbe420$8e54dec2 AT satan> <5fdmdn$mn8 AT freenet-news DOT carleton DOT ca> NNTP-Posting-Host: newton.alcyone.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Paul Derbyshire 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)); > > and is more readable. It will work, but it's not strictly-conforming ANSI C. Converting to a void * to any other pointer type requires an explicit typecast. -- Erik Max Francis, &tSftDotIotE / email: max AT alcyone DOT com Alcyone Systems / web: http://www.alcyone.com/max/ San Jose, California, United States / icbm: 37 20 07 N 121 53 38 W \ "I am become death, / destroyer of worlds." / J. Robert Oppenheimer (quoting legend)