Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!cs.utexas.edu!uunet!twwells!bill From: bill@twwells.com (T. William Wells) Newsgroups: comp.std.c Subject: Re: Common malloc/free practice violates ANSI standard ? Message-ID: <1989Oct30.104153.804@twwells.com> Date: 30 Oct 89 10:41:53 GMT References: <1989Oct14.043811.669@anucsd.oz> <1989Oct19.101306.16791@twwells.com> <1328@crdos1.crd.ge.COM> Organization: None, Ft. Lauderdale, FL Lines: 24 In article <1328@crdos1.crd.ge.COM> davidsen@crdos1.UUCP (bill davidsen) writes: : In article <1989Oct19.101306.16791@twwells.com>, bill@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. My error. I should have said, somewhere, that all this is dependent on knowing that the pointer really can point to an OBJ, as in the result of a malloc. I hope that my later articles have adequately corrected this mistake. Sorry I wasn't more careful. --- Bill { uunet | novavax | ankh | sunvice } !twwells!bill bill@twwells.com