Xref: utzoo comp.std.c:1825 comp.lang.c:22879 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!shadooby!ginosko!aplcen!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.std.c,comp.lang.c Subject: Re: Common malloc/free practice violates ANSI standard ? Message-ID: <11294@smoke.BRL.MIL> Date: 16 Oct 89 03:29:33 GMT References: <1989Oct14.043811.669@anucsd.oz> Reply-To: gwyn@brl.arpa (Doug Gwyn) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 11 In article <1989Oct14.043811.669@anucsd.oz> bdm@anucsd.oz (Brendan McKay) writes: >Note that I'm not claiming the Standard is broken, only that the writers of >the standard have accidentally ruled out a common coding practice. No, we didn't -- any valid pointer can be converted to a pointer that has less strict alignment and back, so that the result compares equal to the original pointer, void* has the same alignment requirement as char*, and converting a coarsely-aligned malloc() void* to OBJ* does NOT result in adjustment of the alignment. Apply ALL the relevant constraints and you'll find that there is no problem with typical malloc()/free() usage.