comp.lang.ada
 help / color / mirror / Atom feed
From: Gilbert Gosseyn <hnptz@yahoo.de>
Subject: old problem
Date: Thu, 30 May 2019 03:26:15 -0700 (PDT)
Date: 2019-05-30T03:26:15-07:00	[thread overview]
Message-ID: <6df29358-0e30-4478-9473-6580d5cb555c@googlegroups.com> (raw)

with Ada.Numerics; use Ada.Numerics;
with Ada.Numerics.Generic_Real_Arrays;
package allx is
   type Real is digits 18;
   package RA is new Ada.Numerics.Generic_Real_Arrays(Real);
   use RA;
   Dx,Dy,gK : Positive;
   subtype RM is Real_Matrix(1..Dy,1..Dx);
   type weight_array is array(1..gK) of RM;
end allx;

with allx; use allx;
with Ada.Text_IO;use Ada.Text_IO;
procedure testall is
   package RIO is new Float_IO(Real);
   use RIO;
   use allx.RA;
   W : weight_array;
   D : RM := (others => (others => 1.0));
   procedure testallx(D1 : RM;
                      W1 : in out weight_array) is
   begin
      for i in 1..gK loop
         W1(i) := Real(i)*D1;
      end loop;
   end testallx;

begin
   Dx := 3;
   Dy := 5;
   gK := 3;
   testallx(D,W);
   for k in 1..Dx loop
      new_line(2);
      for i in 1..Dy loop
         new_line;
         for j in 1..gK loop
            RIO.put(W(k)(i,j));
         end loop;
      end loop;
   end loop;
end testall;

raised CONSTRAINT_ERROR : testall.adb:13  (W1(i) := ...)  index check failed, and of course if I use numbers in package allx, then W1(i) is known.
How to keep the dimensions Dx,Dy,gK open until execution?


             reply	other threads:[~2019-05-30 10:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-30 10:26 Gilbert Gosseyn [this message]
2019-05-30 17:08 ` old problem Anh Vo
2019-05-31  1:04 ` Keith Thompson
2019-05-31 12:37 ` Simon Wright
replies disabled

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