Re: why is casting malloc a bad thing?

From: Daniel Haude (haude_at_physnet.uni-hamburg.de)
Date: 01/30/04


Date: 30 Jan 2004 10:57:37 GMT

On 26 Jan 2004 13:42:11 GMT,
  Mark A. Odell <nospam@embeddedfw.com> wrote
  in Msg. <Xns947C588821BF2CopyrightMarkOdell@130.133.1.4>

> Why would a C++ compiler need to worry about malloc()'ing code? They have
> memory allocation schemes of their own in C++.

...and indeed, IIRC, you're recommended to only use new to allocate memory
in C++ anyway; malloc() is considered bad style. Which gives us yet
another reason against the cast: When C++ balks about an uncast malloc()
it's time to change it to "new" instead (and to get rid of the
corresponding free() as well). But this is OT on clc.

--Daniel

-- 
"With me is nothing wrong! And with you?" (from r.a.m.p)