🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.modula2
Article #2405

Re: JPI Compiler bug?

#2405
From: Sean Wilson
Date: Thu, 21 Jan 1993 18:21
34 lines
1782 bytes
m >   So, let's put it this way: What does

m >               ALLOCATE ( PointerVariable, SIZE( PointerVariable^ ) )

m >   really perform? What do you achieve with an NEW(PointerVariable) call? m >   Still assuming that PointerVariable points at some structured type such m >   as RECORD.

m >   Marcus

Assuming you have done a:

  FROM Storage IMPORT ALLOCATE;

The call:

    ALLOCATE ( PointerVariable, SIZE( PointerVariable^ ) );

Invokes a specific procedure to allocate a block of the specified size from the heap and return it for use in PointerVariable.

The NEW() operator provides some generalisation. It always needs a procedure called ALLOCATE() of the same formal type as Storage.ALLOCATE() but it doesn't impose any further restrictions.  Your XStorage.ALLOCATE() procedure can do what it likes.  It also reduces the chance of error in the stongly typed storage system, e.g: how many times have you typed:

  ALLOCATE(PointerVariable, SIZE(PointerVariable));

So by using NEW() you have some flexibility in choosing your storage management, plus added safety.  I typically use it in conjunction with debugging storage functions.

Best regards
  Sean.

___
 X PQ-Under-Trial 2.15 X CA Raisins murdered!  Cereal Killer? Film at 11.


--  
uucp: uunet!m2xenix!puddle!139!590!Sean.Wilson
Internet: Sean.Wilson@f590.n139.z1.fidonet.org
Technical Details
Message-ID: <40648.2B5FB768@puddle.fidonet.org>
Path: arc1-ca.pugleaf.net!sparky!uunet!psgrain!puddle!f590.n139.z1.fidonet.org!Sean.Wilson

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!psgrain!puddle!f590.n139.z1.fidonet.org!Sean.Wilson
From: Sean.Wilson@f590.n139.z1.fidonet.org (Sean Wilson)
Sender: ufgate@puddle.fidonet.org (newsout1.26)
Newsgroups: comp.lang.modula2
Subject: Re: JPI Compiler bug?
Message-ID: <40648.2B5FB768@puddle.fidonet.org>
Date: Thu, 21 Jan 93 11:21:10 PDT
Organization: FidoNet node 1:139/590 - PMI BBS, Green Bay WI
Lines: 34