comp.lang.ada
 help / color / mirror / Atom feed
* Defining types in private packages for use in parent spec
@ 2003-08-27  7:51 Lutz Donnerhacke
  2003-08-27  8:56 ` Dmitry A. Kazakov
  2003-08-29 17:02 ` Stephen Leake
  0 siblings, 2 replies; 4+ messages in thread
From: Lutz Donnerhacke @ 2003-08-27  7:51 UTC (permalink / 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



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-08-29 17:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-27  7:51 Defining types in private packages for use in parent spec Lutz Donnerhacke
2003-08-27  8:56 ` Dmitry A. Kazakov
2003-08-27  9:03   ` Lutz Donnerhacke
2003-08-29 17:02 ` Stephen Leake

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