🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.modula2
Article #1857

POINTER/LINKED LIST HELP?

#1857
From: 2hnenature
Date: Sat, 30 Mar 1991 21:14
27 lines
1664 bytes
  I seem to have a problem with using the type POINTER with linked lists.
I have a seperate module with linked list functions such as Delete,Insert,
NewList etc., that I have written myself.  The problem is that I wish to make
these procedures as general as possible so they can be used with a variety of
programs.  Is it possible to specify a general POINTER type that can point to
any data type?  I assume it must be possible since the function NEW(x) allows x
to be a pointer to any type of data. 
 Related to this, I have a field in my linked list of RECORDS that contains a 
pointer to the next element in the linked list. The field is presently called
Link and I use this field to traverse the list:
 
eg.  WHILE Current#NIL DO
            Current:=Current^.Link...

As it stands now any linked list that wants to use these functions must have
a field called "Link."  Is there any way I could remove this limitation?  It is
handicapping, since if I want to use two different linked lists in a program I
must have a field "Link" in each list.

Am I making any sense?

  BTW I am using a VMS Modula-2 compiler. 
                                 Thanks for any help...
                                        S Pendleton

2hnenature@kuhub.cc.ukans.edu
Technical Details
Message-ID: <1991Mar30.151406.29367@kuhub.cc.ukans.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!caen!kuhub.cc.ukans.edu!2hnenature

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!caen!kuhub.cc.ukans.edu!2hnenature
From: 2hnenature@kuhub.cc.ukans.edu
Newsgroups: comp.lang.modula2
Subject: POINTER/LINKED LIST HELP?
Message-ID: <1991Mar30.151406.29367@kuhub.cc.ukans.edu>
Date: 30 Mar 91 15:14:06 CST
Organization: University of Kansas Academic Computing Services
Lines: 27