Mail Archives: djgpp/1997/03/04/22:56:26
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!
- Raw text -