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
3 answers

Ada read a string (scanf %s equivalent)

How can I read a word (skip whitespace and read characters until a whitespace is encountered) similar to scanf("%s") in C?
ArekBulski
  • 4,520
  • 4
  • 39
  • 61
1
vote
2 answers

Type checking and range checking

In one of the textbooks I'm reading is stated "While types are checked for compatibility at compile time, subranges require run-time range checking." If I'm getting it right, a runtime check must be performed when new values are assigned to a…
Drimades Boy
  • 437
  • 1
  • 5
  • 19
1
vote
1 answer

Unnecessary Ada dependency recompilations (GCC 5.3.0)

After a recent GCC update, we noticed some of our precompiled common functions were being recompiled every time an application using them was built. It appears to be related to our use of gnat.adc files to store pragmas. I do have a workaround, but…
Kevin
  • 510
  • 4
  • 16
1
vote
2 answers

*.ads file not found when compiling Ada with a makefile

I am trying to compile an ada program but I am having the following error: test.adb:4:06: file "motormachinestate.ads" not found. Of course, the problem is that the Makefile is wrong. I have been searching how to fix it but I have been unable. The…
Dan
  • 2,452
  • 20
  • 45
1
vote
1 answer

Interface Ada dynamic Library with Java using JNA and Ada's Interface.C packages

I have to write a DLL is supposed to provide a simple service that takes: IN a string or byte array (equivalent of char*) IN integer expliciting the size of the in char* IN equivalent of char* buffer used by library to write data in IN size of the…
LoneWanderer
  • 3,058
  • 1
  • 23
  • 41
1
vote
2 answers

Ada: Understanding variable'Size vs type'Size vs value_size vs object_size

Let the following Ada types be defined: type Type_Huge is array (1 .. Integer'Last) of Float; type Type_B is (foo, bar, blop, bloub); type Type_A ( disc : Type_B := foo) is record case disc is when foo => …
LoneWanderer
  • 3,058
  • 1
  • 23
  • 41
1
vote
2 answers

Access type declaration effect on deallocation

Is the memory freed the same way after the declare block (and before the end of the procedure of course) in both cases: procedure allocation is type T_Integer_Access is access Integer; begin declare P : T_Integer_Access; begin …
user2563654
1
vote
3 answers

How can you link a type's values sequentially to integers?

I am trying to have a program that takes a number from the user (from 1 - 12) and it will return that month's short form, eg: if you write 1 it will return JAN etc. I have the following: type Month_Type is (JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG,…
Aequitas
  • 2,205
  • 1
  • 25
  • 51
1
vote
1 answer

Convert Standard.Natural to Ada.Containers.Count_Type

I instanced the Ada.Containers.Vectors generic package like this: package My_Vectors is new Ada.Containers.Vectors( Element_Type => My_Type, Index_Type => Natural); Say, I have a vector and a Standard.Natural value declared: Foo_Vector:…
Basti Vagabond
  • 1,458
  • 1
  • 18
  • 26
1
vote
1 answer

Ada Type Declaration Semantics

I am taking Ada in college. Today my professor posed a question to us. In the following bit of code there are three type declarations. The third one doesn't compile with an error 'missing new'. I am assuming that the 'Type' keyword lets the…
Michael Riley
  • 67
  • 1
  • 10
1
vote
2 answers

How to make a variable read-only, but not constant?

Providing read-only access to a variable may (of course?) be achieved through abstraction. For example, I could make the variable an in mode parameter of a callable entity, or of a generic. The uses of the variable (through these constant views)…
B98
  • 1,229
  • 12
  • 20
1
vote
1 answer

Ada: Write to File Multiple Times

In Ada, can you open, write to, close, then reopen, write to, and close a txt file without it being overwritten? Like continue from where it last left off? Thanks!
Numnumberry
  • 415
  • 4
  • 16
1
vote
3 answers

Ada container in a Extended tagged type

I want to had a container in an extended tagged type. Ex. : type Root is abstract tagged private; package Queue_Interface is new Ada.Containers.Synchronized_Queue_Interfaces (Element_Type => Ada.Strings.Unbounded.Unbounded_String); package…
Joker
  • 247
  • 3
  • 7
1
vote
2 answers

Array sequence algorithm efficiency

I am looking for suggestions for a more efficient algorithm to determine if an array contains all the values from 1 through the length of the array. The solution I have devised works correctly using…
Jim Rogers
  • 4,822
  • 1
  • 11
  • 24
1
vote
2 answers

Ada: Pragma List

Can anybody tell me what Pragma List does (specifically, what is "listing of the compilation")? I don't understand the description from the LRM (2.8.25) A pragma List takes one of the identifiers On or Off as the single argument. This pragma is…
Glen
  • 83
  • 1
  • 4