comp.lang.ada
 help / color / mirror / Atom feed
From: John English <je@bton.ac.uk>
Subject: Re: Help: my list adt is broken
Date: Mon, 12 Feb 2001 14:23:50 +0000
Date: 2001-02-12T14:23:29+00:00	[thread overview]
Message-ID: <3A87F1F6.664D51BC@bton.ac.uk> (raw)
In-Reply-To: U0Rh6.14303$zz4.333772@news2-win.server.ntlworld.com

"chris.danx" wrote:
> 
> Hi,
>     Thanks again for everyones help.  In the end it only took 6 lines of
> code to fix (two if statements ...).  One thing interests me though.  Why
> wasn't an exception generated when i walked the list?  I deleted the node p
> in the code, so it shouldn't be there, should it?

Your list still pointed to the deleted item; the block of memory is
still there (you haven't deleted a chunk of physical RAM ;-) but you
were lucky (unlucky?) that the block hadn't been reallocated and
used for something else.

It's your responsibility to avoid referring to memory blocks that you
delete, and that's why the deletion is done by a procedure called
UNCHECKED_Deallocation... there are no runtime checks to ensure that
your pointers are all still valid afterwards.

-----------------------------------------------------------------
 John English              | mailto:je@brighton.ac.uk
 Senior Lecturer           | http://www.it.bton.ac.uk/staff/je
 Dept. of Computing        | ** NON-PROFIT CD FOR CS STUDENTS **
 University of Brighton    |    -- see http://burks.bton.ac.uk
-----------------------------------------------------------------



  reply	other threads:[~2001-02-12 14:23 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-02-11 21:04 Help: my list adt is broken chris.danx
2001-02-11 23:01 ` Larry Hazel
2001-02-12  0:29 ` tmoran
2001-02-12  0:29 ` Chad R. Meiners
2001-02-12 12:17 ` chris.danx
2001-02-12 12:50 ` chris.danx
2001-02-12 14:23   ` John English [this message]
2001-02-12 15:10     ` chris.danx
2001-02-12 17:33 ` chris.danx
2001-02-12 20:00   ` tmoran
  -- strict thread matches above, loose matches on Subject: below --
2001-02-11 21:05 chris.danx
2001-02-11 21:08 ` chris.danx
2001-02-12 14:55 ` Ted Dennison
2001-02-12 21:14 schwarza
2001-02-12 23:09 ` chris.danx
2001-02-13  1:42   ` Jeffrey Carter
2001-02-13 15:35 schwarza
2001-02-14 11:47 ` John English
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox