comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Problems with Dave's LinkedList
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Problems with Dave's LinkedList [message #24376] Mon, 02 April 2001 11:25 Go to next message
s007amf is currently offline  s007amf
Messages: 8
Registered: January 2001
Junior Member
I am using Dave Fanning's LinkedList object and seem to have run into a
problem with it. In the procedure Delete_Node, I was getting a Invalid
Pointer error on line:

IF NOT Ptr_Valid((*currentNode).previous) THEN BEGIN

To me, it looks like the error occurs when the linked list only has one
node left. Dave has code that should deal with this condition on line:

IF index EQ (self.count - 1) THEN self->Delete_Last_Node

This code does deal with the above condition, but does not cause
Delete_Node to exit. Therefore, the list is empty and tries to execute
the first line I mentioned; which, causes a runtime error.

I changed the second line I mentioned into the following block of code
(which seems to fix the error):


IF index EQ (self.count - 1) THEN BEGIN
self->Delete_Last_Node
RETURN
END


--
Alan
Re: Problems with Dave's LinkedList [message #24505 is a reply to message #24376] Tue, 03 April 2001 03:24 Go to previous message
Martin Schultz is currently offline  Martin Schultz
Messages: 515
Registered: August 1997
Senior Member
David Fanning wrote:
>
> Pavel A. Romashkin (pavel.romashkin@noaa.gov) writes:
>
>> I am afraid, mine would not qualify for the USDA seal of "organic". Some
>> are affected by beers, others by tylenols :-(
>
> I think beer qualifies as organic.

... only if brewed according to the German "Reinheitsgebot" ;-) I
heard that American beer is full of antibiotics etc. (or was that cows
?). Oh well, we shouldn't be too proud of our cattle these days either
;-(

Cheers,

Martin

PS: David: when you come, could you bring a good burger?

> I heard it described
> on NPR the other day as "liquid bread". They were
> trying to tell me, Pavel, that beer goes good with
> desserts, as long as the beer is sweeter than the
> dessert. Souundeed gud to mee. :-)
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting
> Phone: 970-221-0438 E-Mail: davidf@dfanning.com
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
> Toll-Free IDL Book Orders: 1-888-461-0155

--
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ [[[[[[[
[[ Dr. Martin Schultz Max-Planck-Institut fuer Meteorologie [[
[[ Bundesstr. 55, 20146 Hamburg [[
[[ phone: +49 40 41173-308 [[
[[ fax: +49 40 41173-298 [[
[[ martin.schultz@dkrz.de [[
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ [[[[[[[
Re: Problems with Dave's LinkedList [message #24519 is a reply to message #24376] Mon, 02 April 2001 14:21 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Pavel A. Romashkin (pavel.romashkin@noaa.gov) writes:

> I am afraid, mine would not qualify for the USDA seal of "organic". Some
> are affected by beers, others by tylenols :-(

I think beer qualifies as organic. I heard it described
on NPR the other day as "liquid bread". They were
trying to tell me, Pavel, that beer goes good with
desserts, as long as the beer is sweeter than the
dessert. Souundeed gud to mee. :-)

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
Re: Problems with Dave's LinkedList [message #24520 is a reply to message #24376] Mon, 02 April 2001 14:02 Go to previous message
Pavel A. Romashkin is currently offline  Pavel A. Romashkin
Messages: 531
Registered: November 2000
Senior Member
David Fanning wrote:

> ...programs sometimes
> grow organically.

I am afraid, mine would not qualify for the USDA seal of "organic". Some
are affected by beers, others by tylenols :-(

Cheers,
Pavel
Re: Problems with Dave's LinkedList [message #24523 is a reply to message #24376] Mon, 02 April 2001 11:55 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
ALAN FRAZIER (s007amf@news.wright.edu) writes:

> I am using Dave Fanning's LinkedList object and seem to have run into a
> problem with it. In the procedure Delete_Node, I was getting a Invalid
> Pointer error on line:
>
> IF NOT Ptr_Valid((*currentNode).previous) THEN BEGIN
>
> To me, it looks like the error occurs when the linked list only has one
> node left. Dave has code that should deal with this condition on line:
>
> IF index EQ (self.count - 1) THEN self->Delete_Last_Node
>
> This code does deal with the above condition, but does not cause
> Delete_Node to exit. Therefore, the list is empty and tries to execute
> the first line I mentioned; which, causes a runtime error.
>
> I changed the second line I mentioned into the following block of code
> (which seems to fix the error):
>
>
> IF index EQ (self.count - 1) THEN BEGIN
> self->Delete_Last_Node
> RETURN
> END

Ah, this is a problem, I think, in how programs sometimes
grow organically.

This was one of the first programs I wrote shortly after
pointers were introduced in IDL. I wanted to learn how
to use them, and I thought a linked list was a good
programming exercise. It was that, and much, much more.
When I was finished I pretty much didn't want to *look*
at another pointer for a long, long time!

It is a mystery to me why something so simple in theory
can be so exasperatingly complex in detail. I grimace
just thinking about the experience.

But, anyway, I set out to do one thing, and I ended up
doing something else. And by the time I was done, the
program worked, but it was a lot more fragile than I
expected it to be. When I decided to publish it, I knew
it had to be more robust, but the thought of re-writing
all that tedious code was still too fresh.

So what I did instead was add a robust public interface
to the private methods I had already worked out. I kind
of liked this solution because it tied in nicely with
a little lecture I was giving about pointers and objects.
But with two years hindsight, I can see it may have not
been the brightest idea I ever had. But, in any case,
I thought I documented the public methods pretty well.

The point of this long-winded story is that you are
using one of the private methods (DELETE_NODE) instead
of the proper public method (DELETE). The public method
will call the appropriate private methods, and will do
so appropriately and without having to resort to making
changes in the code. (Thank God!!)

Cheers,

David

P.S. Let's just say I can see the benefit of re-writing this
program, but, unfortunately, it is WAY down on my list. :-)

--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: wavelet
Next Topic: dlm creating an array?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 09:20:33 PDT 2025

Total time taken to generate the page: 0.00714 seconds