Let's say I want to dynamically allocate some memory to an object that I am creating using malloc(). Traditionally I do the following: ObjectType *objectpointer; /* Decl. of pointer to object */ objectpointer = (ObjectType *)malloc(sizeof(ObjectType)); My question. Do I really need to add the type cast (ObjectType *) before the call to malloc() ? Traditionally I have always been taught to include the cast. However, some references say that a cast was ONLY required in earlier versions of C prior to standard ANSI C. Nonetheless I always type cast as that is how I have done it for years and years. Do I really need the cast? More precisely, do I really need the cast using gcc? /John <[EMAIL PROTECTED]> -- email: [EMAIL PROTECTED] Local mailserver <landreau.ruffe.edu> , remote <ns.computer.net>
begin:vcard n:Holotko;John x-mozilla-html:FALSE org:MicroService Co. adr:;;;;;; version:2.1 email;internet:[EMAIL PROTECTED] title:Programmer note;quoted-printable:Unix, Systems Programming, Applications, =0D=0ASoftware Develpment, Sytems Administration, =0D=0AWeb Development/Programming. x-mozilla-cpt:;-2400 fn:John Holotko end:vcard
