🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #716

Re: Common malloc/free practice violates ANSI standard ?

#716
From: Conor P. Cahill
Date: Sun, 15 Oct 1989 23:24
22 lines
1525 bytes
In article <1989Oct14.043811.669@anucsd.oz>, bdm@anucsd.oz (Brendan McKay) writes:
> No doubt this problem was unintentional.  It could easily be fixed by a
> sentence reading something like
> "The pointer returned if the allocation succeeds is such that, if it is cast
> to a pointer to any type of object and then that pointer is cast to type
> void*, the original value is recovered."

That is the meaning of the "suitably aligned so that it may be
assigned to a pointer to any type of object and then used to access such an
object..." (Section 4.10.3).

An assignment of a void* pointer that is an invalid address for an OBJ*
will usually cause a core drop at the point of dereference and may cause
a core drop at the assignment.  It *should* not modify the value of the 
pointer.


-- 
+-----------------------------------------------------------------------+
| Conor P. Cahill     uunet!virtech!cpcahil      	703-430-9247	!
| Virtual Technologies Inc.,    P. O. Box 876,   Sterling, VA 22170     |
+-----------------------------------------------------------------------+
Technical Details
Message-ID: <1279@virtech.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!gem.mps.ohio-state.edu!ginosko!uunet!virtech!cpcahil
References: <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!ginosko!uunet!virtech!cpcahil
From: cpcahil@virtech.UUCP (Conor P. Cahill)
Newsgroups: comp.std.c,comp.lang.c
Subject: Re: Common malloc/free practice violates ANSI standard ?
Message-ID: <1279@virtech.UUCP>
Date: 15 Oct 89 23:24:46 GMT
References: <1989Oct14.043811.669@anucsd.oz>
Organization: Virtual Technologies Inc
Lines: 22