🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.modula2
Article #4880

Re: MetCom (IT'S A WARNING!!!!)

#4880
From: Bob Campbell
Date: Thu, 14 Dec 1989 19:00
33 lines
1981 bytes
For the record the following peice of code works.  I know I tested it this 
time.

TYPE
  MyThingy = RECORD x,y,z : INTEGER END;
  MyPoint = POINTER TO MyThingy;
VAR
  x: MyPoint;
BEGIN
ALLOCATE (x, SIZE (x^));

It is true that x^ might dereference the variable x, but because this
is only one level deep, the dereferencing code is not generated (by any
of the MetCom products).  A more complex expression like x^.y^.z^ might
cause more problems (the MPW compiler does not like this at all, I will
have to see if that can be fixed).   It could be argued that this method
should only be used when you need to convert between NEW and ALLOCATE,
but I can't think of can good reasons that require that to be done more
then once.

The bottom line is that if you don't write your code intending to use NEW, 
then you can write code that works using the actual type instead of 
dereferencing the variable to get it's size.  This code is portable and 
would work with almost any Modula-2 compiler.  As a side note I don't use 
ALLOCATE normally  I call the Macintosh routine NewPtr.

In the last message I said something about "Apple's MPW Product" I was 
talking about the MPW shell.  Apple does not have a Modula-2 product, and 
the only Macintosh Modula-2 compilers that I am aware of are SemperSoft, 
P1 and MetCom (aka MetroWorks).

Applelink: BOBC (BOBC@Applelink.apple.com)
Quickmail: Bob Campbell@ZORRO (Bob_Campbell.ZORRO@gateway.qm.apple.com)
Technical Details
Message-ID: <5765@internal.Apple.COM>
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!samsung!brutus.cs.uiuc.edu!apple!gateway.qm.apple.Com!Bob_Campbell.ZORRO
References: <"89-12-11-21:03:38.02*UK4H"@DKAUNI2.BITNET> <172@fornax.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!samsung!brutus.cs.uiuc.edu!apple!gateway.qm.apple.Com!Bob_Campbell.ZORRO
From: Bob_Campbell.ZORRO@gateway.qm.apple.Com (Bob Campbell)
Newsgroups: comp.lang.modula2
Subject: Re: MetCom (IT'S A WARNING!!!!)
Message-ID: <5765@internal.Apple.COM>
Date: 14 Dec 89 19:00:48 GMT
Sender: usenet@Apple.COM
Organization: Apple Computer, Inc.
Lines: 33
References: <"89-12-11-21:03:38.02*UK4H"@DKAUNI2.BITNET> <172@fornax.UUCP>