From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,7903a7ed8de6a521 X-Google-Attributes: gid103376,public From: kst@thomsoft.com (Keith Thompson) Subject: Re: Ada 95 Compatibility Date: 1996/02/23 Message-ID: #1/1 X-Deja-AN: 140811451 sender: news@thomsoft.com (USENET News Admin @flash) x-nntp-posting-host: pulsar references: <4gi8o8$an2@newsbf02.news.aol.com> organization: Thomson Software Products, San Diego, CA, USA newsgroups: comp.lang.ada originator: kst@pulsar Date: 1996-02-23T00:00:00+00:00 List-Id: 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