From: av568 AT rgfn DOT epcc DOT edu (Beautiful Savior Lutheran Church) Newsgroups: comp.os.msdos.djgpp Subject: Re: quick malloc question Date: 5 Mar 1997 02:54:06 GMT Organization: The Rio Grande Free-Net, El Paso Community College, El Paso, TX Lines: 23 Message-ID: <5fin8e$q39@news.epcc.edu> References: <5fdn2o$mvl AT freenet-news DOT carleton DOT ca> NNTP-Posting-Host: rgfn.epcc.edu To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Paul Derbyshire (ao950 AT FreeNet DOT Carleton DOT CA) wrote: > "Cristovao Braga" (cbraga AT datasoft DOT com DOT br) writes: > > char *p; > > > > main () > > { > > p = (char *) malloc (5 * 1024 * 1024); > > } > Why the HELL do people keep writing things like (char *)malloc(x)???????? > GCC, and to my knowledge other compilers, allow any pointer to be assigned > to a variable of type void * and conversely allow any variable of type void > * to be assigned to any pointer, without casts. Because it *ensures* that the code will work, even on non-ANSI compliant machines. Why the hell do you write "int main(void)" instead of "main()" of "void main(void)"? It ensures your code will work. -- Beautiful Savior Evangelical Lutheran Church - av568 AT rgfn DOT epcc DOT edu We have what you need-- A Savior!