Xref: utzoo comp.std.c:1936 comp.lang.c:23197 Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!cs.utexas.edu!uunet!twwells!bill From: bill@twwells.com (T. William Wells) Newsgroups: comp.std.c,comp.lang.c Subject: Re: commom malloc/free practice breaks standard - author strikes back Message-ID: <1989Oct24.002714.3687@twwells.com> Date: 24 Oct 89 00:27:14 GMT References: <1989Oct16.111059.3840@anucsd.oz> <416@cpsolv.UUCP> <11334@smoke.BRL.MIL> <420@cpsolv.UUCP> Organization: None, Ft. Lauderdale, FL Lines: 51 In article <420@cpsolv.UUCP> rhg@cpsolv.uucp (Richard H. Gumpertz) writes: : [nonsense, because he either has an older standard or has't read it very : carefully.] I decided to collect the sections of the standard relevant to the debate. Here they are: 3.1.2.5: "A pointer to void shall have the same representation and alignment requirements as a pointer to a character type." 3.2.2.3: "A pointer to void may be converted to or from a pointer to any incomplete or object type. A pointer to any incomplete or object type may be converted to a pointer to void and back again; the result shall compare equal to the original pointer." 3.3.4: "A pointer to an object or incomplete type may be converted to a pointer to a different object type or a different incomplete type. The resulting pointer might not be valid if it is improperly aligned for the type pointed to. It is guaranteed, however, that a pointer to an object of a given alignment may be converted to a pointer to an object of the same alignment or a less restrictive alignment and back again; the result shall compare equal to the original pointer. (An object that has character type has the least strict alignment.)" 3.3.9: "If two pointers to object or incomplete types compare equal, they point to the same object. If two pointers to functions compare equal, they point to the same function. If two pointers point to the same object or function, they compar equal." 4.10.3: "The pointer returned if the allocation succeeds is suitably aligned so that it may be assigned to a pointer of any type of object and then used to access such an object in the space allocated (until the space is explicitly freed or reallocated). Each such allocation shall yield a pointer to an object disjoint from any other object. The pointer returned points to the start (lowest byte address) of the allocated space." --- Bill { uunet | novavax | ankh | sunvice } !twwells!bill bill@twwells.com