Common malloc/free practice violates ANSI standard ?

Wm E Davidsen Jr davidsen at crdos1.crd.ge.COM
Tue Oct 24 00:51:05 AEST 1989


In article <1989Oct19.101306.16791 at twwells.com>, bill at twwells.com (T. William Wells) writes:
|  The standard requires that casting from (void*) to (OBJ*) and back
|  give pointers that compare equal and point to the same object.
|  Free will have no problems with it.

  I think you said this backward (or you misread it). You can cast *to*
a void pointer and *back* without loss of information, but not the
other way 'round. On machines which require allignment at all,
assignment to a pointer to an alligned type may result in loss of
information via rounding.

-- 
bill davidsen	(davidsen at crdos1.crd.GE.COM -or- uunet!crdgw1!crdos1!davidsen)
"The world is filled with fools. They blindly follow their so-called
'reason' in the face of the church and common sense. Any fool can see
that the world is flat!" - anon



More information about the Comp.std.c mailing list