โŒ About FreshRSS

Normal view

There are new articles available, click to refresh the page.
Before yesterdayNews from the Ada programming language world

Ada types using "(<>)"

I am looking at some legacy Ada code.

type My_Test_Type is (<>);
type My_Table_Type is array(My_Test_Type) of Integer;

When I try to use this code in the GNAT community IDE, I get this error:

ads:9:26: error: identifier expected

This is the line it's pointing to:

type My_Test_Type is (<>);

When I build the code in the legacy IDE, it compiles and runs fine.

Any ideas what is going on here?

I've tried this only on my local PC running GNAT Studio Community 2021 (20210423) hosted on x86_64-w64-mingw32.

The legacy system is a cross compiler for the Power PC. It's old.

Ok, Here is more context.

I took the above lines an created a package which I am building and running in GNAT Studio community addition.

Here is the my_generic.ads

package My_Generic is
 generic
   type My_Test_Type is (<>);
   type My_Table_Type is array(My_Test_Type) of Integer;
   --
   My_Table : My_Table_Type;
   procedure InitMyTable(My_Table : My_Table_Type);   
end My_Generic;

Here is my_generic.adb

with GNAT.IO; use GNAT.IO;
package body My_Generic is
   procedure InitMyTable (My_Table : My_Table_Type) is
   begin
      Put_Line("Entered InitMyTable");
      for i in 1..1000 loop
         My_Table(i) := i + 1000;
      end loop;
      null;
   end InitMyTable;
end My_Generic;

Main is
--...
--...
   InitMyTable_i = new InitMyTable(My_Test_Type => range 1..10);
begin
--...
--...
   Put_Line ("Initializing My table (<>)");
   InitMyTable_i;

end Main;

when I build I get error: declaration expected on the line "InitMyTable_i = new InitMyTable(My_Test_Type => range 1..10);"

I basically have no idea what is going on here. I've tried many different ways to get things to work. Any of the docs I have found, including the ones suggested below, are not helpful.

Thanks

โŒ
โŒ