comp.lang.ada
 help / color / mirror / Atom feed
* Re: Access type question ...
@ 1993-05-24  2:03 Allan Weimer
  0 siblings, 0 replies; only message in thread
From: Allan Weimer @ 1993-05-24  2:03 UTC (permalink / 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)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1993-05-24  2:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1993-05-24  2:03 Access type question Allan Weimer

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