🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.modula2
Article #3766

Pointers and whatnot

#3766
From: Alex Bewley
Date: Sat, 22 Aug 1987 00:06
36 lines
1624 bytes
    (I hope this gets through)...

    I am having a problem with pointers and storage allocation.  When one
usually is using dynamic storage one knows how much space to allocate (as in
the following example, I believe it is syntactically correct).
...
TYPE
    PtrType = POINTER TO DataType;
    DataType = RECORD
                 Text : ARRAY [0..80-1] OF CHAR;
                 next : PtrType;
               END;

VAR
   Ptr : PtrType;

BEGIN
  NEW(Ptr); (* or ALLOCATE(Ptr, TSIZE(DataType); *)
  Assign(Ptr^.Text,"This is some text...");
END;...


   In that above case, Text is 80 chars, but suppose the length of Text varies.
How would I be able to change the type?

   Or suppose I just want 137 bytes of storage of no particular type, can one
have just a POINTER with no TO?  According to my compiler, no (Logitech
Modula-2/86).

   I hope I am not being obscure or stupid, but your help would be appreciated.

Alex Bewley
NetNorth: BOTCHAIR@UOGUELPH

| We don't understand it, let's give it to the programmers... |
Technical Details
Message-ID: <8708220025.AA10833@cayuga.cs.rochester.edu>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!rutgers!ames!ucbcad!ucbvax!UOGUELPH.BITNET!BOTCHAIR

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!rutgers!ames!ucbcad!ucbvax!UOGUELPH.BITNET!BOTCHAIR
From: BOTCHAIR@UOGUELPH.BITNET (Alex Bewley)
Newsgroups: comp.lang.modula2
Subject: Pointers and whatnot
Message-ID: <8708220025.AA10833@cayuga.cs.rochester.edu>
Date: Fri, 21-Aug-87 20:06:01 EDT
Article-I.D.: cayuga.8708220025.AA10833
Posted: Fri Aug 21 20:06:01 1987
Date-Received: Sun, 23-Aug-87 06:28:27 EDT
Sender: daemon@ucbvax.BERKELEY.EDU
Distribution: world
Organization: The ARPA Internet
Lines: 36