Article View: comp.std.c
Article #715Re: Common malloc/free practice violates ANSI standard ?
From: Mike Haertel
Date: Sun, 15 Oct 1989 17:42
Date: Sun, 15 Oct 1989 17:42
17 lines
1405 bytes
1405 bytes
In article <1989Oct14.043811.669@anucsd.oz> bdm@anucsd.oz (Brendan McKay) writes: >* assigning a void* to an OBJ* involves rounding up to an even address The standard doesn't say anything about "rounding" pointers. Assigning a misaligned void* to an OBJ* might well cause a trap when the OBJ* is dereferenced. Or even when the void* is just assigned to it! >* malloc allocates sufficient space so that it will cover an object of > type OBJ even when the void* value returned is rounded up to even. > (Thus, sometimes it actually allocates one more cell than it is asked for.) No! The pointer returned by malloc() always has the most pessimistic necessary alignment. -- Mike Haertel <mike@stolaf.edu> ``There's nothing remarkable about it. All one has to do is hit the right keys at the right time and the instrument plays itself.'' -- J. S. Bach
Technical Details
Message-ID:
<7366@thor.acc.stolaf.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!gem.mps.ohio-state.edu!uakari.primate.wisc.edu!nic.MR.NET!thor.acc.stolaf.edu!mikeReferences:
<1989Oct14.043811.669@anucsd.oz>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!gem.mps.ohio-state.edu!uakari.primate.wisc.edu!nic.MR.NET!thor.acc.stolaf.edu!mike From: mike@thor.acc.stolaf.edu (Mike Haertel) Newsgroups: comp.std.c,comp.lang.c Subject: Re: Common malloc/free practice violates ANSI standard ? Message-ID: <7366@thor.acc.stolaf.edu> Date: 15 Oct 89 17:42:16 GMT References: <1989Oct14.043811.669@anucsd.oz> Reply-To: mike@thor.stolaf.edu () Followup-To: comp.std.c Organization: St. Olaf College, Northfield, MN Lines: 17