From: Brian Osman Newsgroups: comp.os.msdos.djgpp Subject: Re: quick malloc question Date: Mon, 03 Mar 1997 10:30:22 -0500 Organization: Rensselaer Polytechnic Institute, Troy NY, USA Lines: 21 Message-ID: <331AEE8E.6AD5@rpi.edu> References: <5fdn2o$mvl AT freenet-news DOT carleton DOT ca> Reply-To: osmanb AT rpi DOT edu NNTP-Posting-Host: darkwing.stu.rpi.edu 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: > > 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. > > -- > .*. Where feelings are concerned, answers are rarely simple [GeneDeWeese] > -() < When I go to the theater, I always go straight to the "bag and mix" > `*' bulk candy section...because variety is the spice of life... [me] > Paul Derbyshire ao950 AT freenet DOT carleton DOT ca, http://chat.carleton.ca/~pderbysh If you don't, and compile with -Wall (which everyone should) then you get warnings about conversion without a cast. I know it happens with gcc on other platforms, and I think it happens on DOS too. (It still works, but I don't like having warnings...) Brian