comp.lang.ada
 help / color / mirror / Atom feed
From: Lutz Donnerhacke <lutz@iks-jena.de>
Subject: Defining types in private packages for use in parent spec
Date: Wed, 27 Aug 2003 07:51:02 +0000 (UTC)
Date: 2003-08-27T07:51:02+00:00	[thread overview]
Message-ID: <slrnbkoon6.o6.lutz@taranis.iks-jena.de> (raw)

How to solve the following problem? It's necessary to define the type Base
in the implementation defined private subpackage, because it varies on
various implementations.

------------------------------------------------------------------------
package Bigints is
   type Bigint is limited private;
private
   type Base_Array;
   type Base_Access is access Base_Array;
   type Bigint is limited record
      data : Base_Access;
   end record;
end Bigints;

with System;
private package Bigints.Implementation is
   type Base is mod System.Max_Binary_Modulus;
   procedure Demo(a : in out Bigint);
end Bigints.Implementation;

with Bigints.Implementation;
package body Bigints is
   subtype Base is Implementation.Base;
   type Base_Array is array(Positive range <>) of Base;
end Bigints;

package body Bigints.Implementation is
   procedure Demo(a : in out Bigint) is
   begin
      for i in a.data'Range loop
         null;
      end loop;
   end Demo;
end Bigints.Implementation;
------------------------------------------------------------------------

gcc -c bigints.adb
gcc -c bigints-implementation.adb
bigints-implementation.adb:5:17: prefix for "Range" attribute must be array
gnatmake: "bigints-implementation.adb" compilation error



             reply	other threads:[~2003-08-27  7:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-27  7:51 Lutz Donnerhacke [this message]
2003-08-27  8:56 ` Defining types in private packages for use in parent spec Dmitry A. Kazakov
2003-08-27  9:03   ` Lutz Donnerhacke
2003-08-29 17:02 ` Stephen Leake
replies disabled

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