comp.lang.ada
 help / color / mirror / Atom feed
From: ncohen@watson.ibm.com (Norman H. Cohen)
Subject: Re: Ada83 equivalents for Ada95
Date: 1996/05/29
Date: 1996-05-29T00:00:00+00:00	[thread overview]
Message-ID: <4ohivu$jsh@watnews1.watson.ibm.com> (raw)
In-Reply-To: Ds4yxt.7wJ@world.std.com


In article <Ds4yxt.7wJ@world.std.com>, bobduff@world.std.com
(Robert A Duff) writes: 

|> And as Brad says, there aren't many problems.  The two *worst* problems
|> are probably:  (1) There are now 256 Characters, instead of 128, and (2)
|> generic formals need a (<>) to accept an unconstrained array.

A third problem right up there with those is that package bodies that are
not required are now forbidden: 

   package Data is
      Table: array (1 .. 100 ) of Float;
      ...
   end Data;

   package body Data is -- legal but dangerous in Ada 83, illegal in Ada 95
   begin
      for I in Table'Range loop
         Table(I) := ...;
      end loop;
   end Data;

There are simple tricks that can be used in Ada 83 to make the package
body required, and hence legal.  Here's one that was posted here
recently: 

   package Data is
      Table: array (1 .. 100 ) of Float;
      ...
   private
      type Package_Body_Needed;
   end Data;

   package body Data is -- legal but dangerous in Ada 83, illegal in Ada 95
      type Package_Body_Needed is record null; end record;
   begin
      for I in Table'Range loop
         Table(I) := ...;
      end loop;
   end Data;

(One can also use a dummy subprogram rather than a dummy type.)

This should be done even in Ada-83 code that will never be ported to Ada
95.  Otherwise, it's too easy to accidently build a system that includes
the declaration but not the body of package Data, meaning that
Data.Table never gets initialized.

--
Norman H. Cohen    ncohen@watson.ibm.com




  reply	other threads:[~1996-05-29  0:00 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <md5:0CCFC2005521EA8746533FEB9AA03D75>
1996-05-09  0:00 ` Ada83 equivalents for Ada95 James A. Squire
1996-05-10  0:00   ` Robert A Duff
1996-05-24  0:00     ` Joe Gwinn
1996-05-25  0:00       ` JP Thornley
1996-05-28  0:00       ` Brad Balfour
1996-05-28  0:00         ` Robert A Duff
1996-05-29  0:00           ` Norman H. Cohen [this message]
1996-05-29  0:00           ` Ken Garlington
1996-05-17  0:00   ` New POSIX Ada Activity Announcement Shane P. McCarron
1996-05-28  0:00 ` Ada83 equivalents for Ada95 Jon S Anthony
1996-05-29  0:00 ` Ken Garlington
1996-05-31  0:00   ` Robert Dewar
1996-06-03  0:00     ` Ken Garlington
1996-06-03  0:00       ` Robert Dewar
1996-05-25  0:00 tmoran
  -- strict thread matches above, loose matches on Subject: below --
1996-05-10  0:00 tmoran
1996-05-11  0:00 ` Tucker Taft
     [not found] <md5:492A761845FE7D43B3C33CDDC6DB8CD0>
1996-05-10  0:00 ` James A. Squire
1996-05-11  0:00   ` Robert A Duff
replies disabled

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