🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #4491

Re: Should free() take a pointer to const argument?

#4491
From: Mike Rubenstein
Date: Sat, 16 Dec 1995 14:05
22 lines
1211 bytes
Jeff.Dunlop@dbsoft.gigo.com (Jeff Dunlop) wrote:

|> fdcu> Even if the realloc call returns
|> fdcu> the same address as the one passed to it no strictly
conforming program
|> fdcu> can rely on this fact or even detect it since all pointers to
the
|> fdcu> original object are indeterminate after the successful call
to realloc.
|>
|> fdcu> Even if the 2 instances of i have the same memory address
they must be
|> fdcu> regarded as distinct objects because they can never be
referenced at the
|> fdcu> same time, pointers to them can never be compared
|>
|>Why can't they be compared?

Once a pointer is freed, use of it in an expression results in
undefined behavior.

Michael M Rubenstein
Technical Details
Message-ID: <30d2d1b6.58275328@nntp.ix.netcom.com>
Path: arc1-ca.pugleaf.net!ix.netcom.com!netnews
References: <818626119snz@genesis.demon.co.uk> <4am3dn$6s9@natasha.rmii.com> <818898225snz@genesis.demon.co.uk> <1a5_9512152056@gigo.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!ix.netcom.com!netnews
From: miker3@ix.netcom.com (Mike Rubenstein)
Newsgroups: comp.std.c
Subject: Re: Should free() take a pointer to const argument?
Date: Sat, 16 Dec 1995 14:05:16 GMT
Organization: Netcom
Message-ID: <30d2d1b6.58275328@nntp.ix.netcom.com>
References: <818626119snz@genesis.demon.co.uk> <4am3dn$6s9@natasha.rmii.com> <818898225snz@genesis.demon.co.uk> <1a5_9512152056@gigo.com>
NNTP-Posting-Host: ix-dc14-24.ix.netcom.com
X-Newsreader: Forte Agent .99c/16.141