comp.lang.ada
 help / color / mirror / Atom feed
From: kst@thomsoft.com (Keith Thompson)
Subject: Re: Ada 95 Compatibility
Date: 1996/02/23
Date: 1996-02-23T00:00:00+00:00	[thread overview]
Message-ID: <Dn85Jv.7s7@thomsoft.com> (raw)
In-Reply-To: 4gi8o8$an2@newsbf02.news.aol.com

In <4gi8o8$an2@newsbf02.news.aol.com> johnherro@aol.com (John Herro) writes:
>      In Ada 95, a package spec. that doesn't *need* an corresponding body
> can't *have* one.  Here's a simplified program segment that I wrote in Ada
> 83:
> 
> package P is
>    Buffer : array(1 .. 50) of Integer;
> end P;
> 
> package body P is
> begin
>    -- code to initialize Buffer
> end P;
> 
>      The buffer initialization is too complicated to do by initializing to
> an aggregrate in the package spec., such as one would do if initializing
> the buffer to all zeros.  Here's how I rewrote the code for Ada 95; I'm
> wondering if I did it the best way:
[chomp]

The simplest method is to add a pragma Elaborate_Body to the specification
of P, before the first declaration; this makes the body mandatory.

Other alternatives are to add an incomplete type to the private part,
which must be completed in the body, or to add a dummy procedure
declaration to the private part, which again must be completed in
the body.  (Note that there's no need to call the procedure; you can
still do the initialization in the statement part of the package body.)

-- 
Keith Thompson (The_Other_Keith) kst@thomsoft.com
TeleSoft^H^H^H^H^H^H^H^H Alsys^H^H^H^H^H Thomson Software Products
10251 Vista Sorrento Parkway, Suite 300, San Diego, CA, USA, 92121-2718
"As God is my witness, I thought turkeys could fly." -- Arthur Carlson, WKRP




  parent reply	other threads:[~1996-02-23  0:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-02-22  0:00 Ada 95 Compatibility John Herro
1996-02-22  0:00 ` Mark A Biggar
1996-02-23  0:00   ` PHILIP W. BRASHEAR
1996-02-23  0:00 ` Ken Garlington
1996-02-24  0:00   ` John Herro
1996-02-24  0:00     ` Robert Dewar
1996-02-26  0:00       ` Ken Garlington
1996-02-26  0:00         ` Robert Dewar
1996-02-26  0:00         ` Robert Dewar
1996-02-23  0:00 ` Keith Thompson [this message]
1996-02-23  0:00 ` Peter Amey
replies disabled

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