comp.lang.ada
 help / color / mirror / Atom feed
From: jeol!weimer@uunet.uu.net  (Allan Weimer)
Subject: Re: Access type question ...
Date: 24 May 93 02:03:26 GMT	[thread overview]
Message-ID: <weimer.738209006@jeol> (raw)

In <C7I8Cx.7DD@mamba.cs.unm.edu> biao@mamba.cs.unm.edu (Biao Wang) writes:

>I have a question about the ADA access type. This is my program --

>with TEXT_IO;
>use  TEXT_IO;
>procedure DYNAMIC_ALLOCATION is
>    package IO_INTEGER is new INTEGER_IO(INTEGER);
>    use  IO_INTEGER;
>    type POINTER is access INTEGER;
>    A, B : POINTER;
>begin
>    A := new POINTER'(10);
>    ...

Allocation takes place the base type (what the pointer is pointing to).
Change the line above to:

    A := new INTEGER'(10);

To make this clear, and remember what the base type is for an access, I
usually use the convention of naming my access types like:

    type A_INTEGER is access INTEGER;

-- 
Allan Weimer
JEOL USA Inc.
(weimer@jeol.com)

                 reply	other threads:[~1993-05-24  2:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox