Common malloc/free practice violates ANSI standard ?

Alan J Rosenthal flaps at dgp.toronto.edu
Wed Oct 25 01:27:15 AEST 1989


davidsen at crdos1.crd.ge.COM (Wm E Davidsen Jr) writes:
>You can cast *to* a void pointer and *back* without loss of information, but
>not the other way 'round.

This is fine, but why can't we just say that the return value from malloc()
represents a pointer which can be assumed to have been casted to (void *) from
whatever type you like?  This is another way to say the "suitably aligned" rap.

(Flame retardant:  I'm not claiming that the draft does in fact say it in this
way, just claiming that this is a good way to think of it.)

ajr

--
Vs encr vf n xvaq bs frk, gura n chapu va gur zbhgu vf n xvaq bs gnyxvat.



More information about the Comp.std.c mailing list