Questions tagged [ada]

Ada is a structured, statically typed, imperative, wide-spectrum, and object-oriented high-level computer programming language, extended from Pascal and other languages.

Ada is a structured, statically typed, imperative, wide-spectrum, and object-oriented high-level computer programming language, extended from Pascal and other languages.Wikipedia

New to Ada?

Welcome! For learning any language, starting off with a good book is highly recommended. Ada is no different. Ada is different however in the number and quality of online resources available for free. A good starting point is the list of Ada Books On-Line. Once you have some basic learning under your belt, many find Ada LRM to be all the reference they ever need. The Ada Information Clearinghouse also provides a lot of useful links for learning Ada.

If you are looking for a good compiler, GNAT is a production-quality GCC-based Ada compiler that is freely available for Windows, OS X, and Linux; more here. Support and more platforms are available from AdaCore. If you want a more Windows-native compiler, Aonix ObjectAda uses the Microsoft linker, so it can be easier to use in an integrated Windows environment.

Versions

There are multiple versions of the language, named based on the year the ISO standardized the language. Thus there currently are Ada83, Ada95, Ada2005 and Ada2012. Any of those can be referenced as Ada, although the term is more appropriate for the latest version of the language.

Have a question?

When you ask a question, be sure to include any relevant source code. Try to keep the code as minimalist as possible while still reproducing the problem; often the problem will be found during the process. If there are any compiler errors, be sure to indicate:

  • Which compiler you are using?
  • Exactly what errors are shown?
  • On which lines do they occur (mark the lines with comment)?

It is recommended to enable syntax highlighting in the source code that you add to the question. Use the following syntax:

``` lang-ada
-- Ada source code goes here
```

External FAQs

Other External Resources

2354 questions
1
vote
0 answers

Ada data exception infinite loop

When executing my user-created get procedure, in the exception block, my program handles my user-defined exceptions fine but goes into an infinite loop when a data exception occurs. PROCEDURE Get (File: IN Ada.Text_IO.File_Type; Item : OUT Rational)…
Tim
  • 11
  • 1
1
vote
1 answer

Ada - reading large files

I'm working on building an HTTP server, mostly for learning/curiosity purposes, and I came across a problem I've never had in Ada before. If I try to read files that are too big using Direct_IO, I get a Storage Error: Stack Overflow exception. This…
Devsman
  • 434
  • 4
  • 17
1
vote
1 answer

Ada: attribute 'last and 'safe_large

it's very common in Ada to create a derived type say a new Float type with the last element being Float'Last. I have not yet seen someone using Float'Safe_Large instead of the attribute Float'Last when defining a new Float type. On my 32-bit…
yCalleecharan
  • 4,656
  • 11
  • 56
  • 86
1
vote
1 answer

Ada: optimize pragma

in the quest to make an Ada code run faster, I'm including the pragma optimize time in the code (in the declarative part). On compiling in AdaGIDE using the GNAT Ada libre Core compiler, I get a warning message: pragma Optimize(Time); | …
yCalleecharan
  • 4,656
  • 11
  • 56
  • 86
1
vote
1 answer

Ada: windows installation

When downloading the tar file from AdaCore for the GNAT compiler (the libre version), I noticed that there are two exe files for installation purposes: win32ada-gpl-2010.exe of size 2.67 MB and gnat-gpl-2010-i686-pc-mingw32-bin.exe of size 70.2…
yCalleecharan
  • 4,656
  • 11
  • 56
  • 86
1
vote
1 answer

Ada: float instantiation from another package

I'm trying to create a new Float type with 6 digits precision. But it seems that I'm not able to use it. Here's the code from the package MyFloat_IO.ads WITH Ada.Text_IO; PACKAGE MyFloat_IO IS TYPE MyFloat IS DIGITS 6 RANGE…
yCalleecharan
  • 4,656
  • 11
  • 56
  • 86
1
vote
2 answers

Ada compilation confusion

I am trying to get my head around OOP in Ada. In order to do so, I need to understand how to name, compile and link package files with gnatmake. This website (http://www.infres.enst.fr/~pautet/Ada95/chap22.htm) has good examples, but I don't…
cadebe
  • 651
  • 1
  • 12
  • 35
1
vote
3 answers

Passing array of aliased records to a procedure

In Ada 2012, I want to have a linked list inside a declared array, rather than allocated. I want to have the linking pointers set by a procedure. I have simplified my program to the following that demonstrates the principle I want to use but I…
user5069935
1
vote
3 answers

AdaGide: debug mode and release mode

If I understand correctly then the release mode enables a program to run faster than running the program in debug mode. A general question will be if one has to run the program first in debug mode and then switch to run the program in release mode…
yCalleecharan
  • 4,656
  • 11
  • 56
  • 86
1
vote
1 answer

Ada file operation: instantiation and exception

I'm learning Ada and I need some clarifications on file operations. I have just one type: float and I have to create 2 files that will store float values (with append operation). So I'm instantiating a package for the type float and I then declare 2…
yCalleecharan
  • 4,656
  • 11
  • 56
  • 86
1
vote
0 answers

C bindings to Ada package

While I can find plenty of information on generating Ada bindings to C libraries, I can't seem to find anything on the opposite. Specifically, I have some math/science packages that I would like to export to C, to make them more widely usable.…
Patrick Kelly
  • 633
  • 5
  • 22
1
vote
1 answer

Ada - getting string from text file and store in array

Hi im just wondering how to put data in an array if i loop txt and store it in A_Composite Name. procedure Main is type An_Array is array (Natural range <>) of A_Composite; type A_Composite is record Name :…
1
vote
1 answer

Ada Input and Output issue

After typing input from Integer it will automatically skip of getting the inputs from String. I don't know why? Simple Ada code of getting inputs of String and Integer: with ada.Text_IO; use ada.Text_IO; with ada.Integer_Text_IO; use…
1
vote
1 answer

Can't get simple Ada Iterator example to compile

I'm learning Ada and I am trying to get a very simple loop working (using the new iterators syntax from Ada 2012). I cannot see what's wrong... with Ada.Text_IO; use Ada.Text_IO; procedure Arrays is type V is array (0 .. 1, 0 .. 2) of Natural; …
user5069935
1
vote
4 answers

Are there any differences between these two files?

I have two ada files shown below A1.ada procedure KOR616 is I : Integer := 3; procedure Lowest_Level( Int : in out Integer ); pragma Inline( Lowest_Level ); procedure Null_Proc is begin null; end; procedure…
maddy
  • 827
  • 2
  • 11
  • 19
1 2 3
99
100