[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: value of dangling pointer

From: Igor Khavkine
Subject: Re: value of dangling pointer
Date: Wed, 1 Aug 2001 09:43:53 -0400
User-agent: Mutt/1.3.18i

On Wed, Aug 01, 2001 at 02:37:26PM +0300, Kalle Olavi Niemitalo wrote:
> Igor Khavkine <i_khavki@alcor.concordia.ca> writes:
> > You have to remember that the function free() cannot modify the value
> > of its argument (nm->name) since it's only passed by value.
> Please see the recent "Defined?" thread on <news:comp.std.c>,
> in particular <news:3B3BE779.4FEA3647@wizard.net> and
> <news:9hg8ir$jrp$1@oravannahka.helsinki.fi>.

I've read these postings. And I am utterly disgusted by the
fact that loading an _integer_ value into a register may cause
a trap on some architectures (after all, pointers are nothing
but integers). In other words, according to the standard:

Is not valid               Is valid
void *p = malloc(1);    |  void *p = malloc(1);
free(p);                |  free(p);
p;                      |  (long)p;

To my knowledge, on the ix86 loading an address into a register
does not cause any traps, regardless of the value of the pointer.
I just hope any other same architecture has no such sideffects


reply via email to

[Prev in Thread] Current Thread [Next in Thread]