Message-ID: From: Robert Humphris To: "'djgpp AT delorie DOT com'" , "'Eyal Ben-David'" Subject: RE: quick malloc question Date: Mon, 3 Mar 1997 16:17:28 -0000 Encoding: 22 TEXT >`malloc' returns void* while p can be of any pointer type. You are actually >casting from (void*) to (char*). > >In C it is not a problem, the compiler does the conversion for you with or >without warnings (depends on the compiler and warning level). > >In C++ it is a compilation error so you must explicitly cast from one >pointer type to another (except when the target type is void*). What you say is true, but in C++ we are meant to use new to dynamically allocate memory space, in C I believe it to be better practice to always cast your pointers esp. if you use the likes of lint to ensure that your code is extra safe Rob Humphris > > >Eyal. > >