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
1 answer

Ada record representation

I have a record type as follows: type Rec_T is record a : Bit_12_T; b : Bit_4_T; end record; where Bit_12_T is mod 2**12 and Bit_4_T is mod 2**4. To tell the compiler the precise alignment of this record, I use the the for use record…
NeoSer
  • 527
  • 3
  • 16
1
vote
1 answer

Ada preconditions that use private functions?

I am very new to Ada, I am really confused about making things private in an Ada spec file. I have a few private functions which need to stay private but I want to use them as part of pre/post conditions in some of my non-private procedures. When I…
Josh2g
  • 11
  • 2
1
vote
2 answers

Differences between Pthread in C vs C++

So I was able to pass an Ada function using Ada_function'Address to a C_function. Here is the C function: void Create_Process(int * status, void * function) { pthread_t new_thread; //creating function with the given function and no…
Nautilus
  • 105
  • 10
1
vote
1 answer

Cannot get mixed C and Ada program to link with pthread library

I am writing a program in C. I am getting the error: file_name.c:(.text+0x5d): undefined reference to `pthread_create' This specific error comes up when gcc is linking my file_name.o with my main ADA file. For the actual compilation of the C file,…
Nautilus
  • 105
  • 10
1
vote
2 answers

How to transform integer to float and vice-versa in Ada?

Is there some kind of implemented function that would allow to transform an integer to float and vice versa? I managed to write a short function that transforms an integer to float: function Transform(First: Integer) return Float is A: Integer…
John Mayne
  • 237
  • 1
  • 3
  • 14
1
vote
3 answers

What is the Ada command line redirector that is analogous to ">"?

Ada noob here (and also not so hot with the command line in general). I am looking for the Ada command line redirector that would be analogous to ">" in DOS. I am running an Ada application in a command line shell. (William Whitaker's WORDS, if…
abm39
  • 21
  • 3
1
vote
0 answers

Eclipse - AonixADT: "Artifact not found"

Hi a would like to intall ada plugin in eclipse, but i get always this error: "An error occurred while collecting items to be installed session context was:(profile=epp.package.java, …
user408141
1
vote
1 answer

Ada: declarative part, function and packages

I have a query with declarative part, function and packages. I have a package as shown next. Due to the complexity of the Compute_X1 function, I have create a "is separate" for computing this function. The value returned from Compute_X1 is X1 and is…
yCalleecharan
  • 4,656
  • 11
  • 56
  • 86
1
vote
2 answers

Can Ada95 child subunits be used to separate code for maintainability?

I have created an Ada class whose implementation has become quite large. I have a multiple body only methods that I would like move to a separate file for maintainability/readability purposes. My understanding with Ada95 Separates is that you can…
Jerunh
  • 524
  • 5
  • 16
1
vote
1 answer

Call by result Example

Is there any proper example for explaining call-by-result ? (not pseudocode) I have learned that ALGOL 68, Ada could use this way, but I cannot find any clear example of Call-by-Result.
구마왕
  • 488
  • 6
  • 20
1
vote
1 answer

Send string data from Java/Erlang to Ada

I would like to create some interface in Java or Erlang, that process user commads, create string and send this string to Ada application. How I can do that in proper way? I tried do this with sockets but it doesn't work? It will be grateful, if you…
michalk93
  • 189
  • 2
  • 10
1
vote
2 answers

Increment variable every 1000 milliseconds with Ada.Real_Time

I have to make a program that has an active waiting of 1000 milliseconds and then increments a variable during that time inside a while loop. And then, this variable has to be initialized to 0 in every cycle. Can someone give me a clue on how to do…
Wrong
  • 1,195
  • 2
  • 14
  • 38
1
vote
1 answer

Best practices for mapping structure members in an Ada-C binding application

In an Ada-C binding application where the structures(records) need to be passed and read/written between functions defined in C and Ada, what is the best way to declare structers at C and Ada side to ensure correct mapping of members between both…
Akay
  • 1,092
  • 12
  • 32
1
vote
1 answer

Ada - Incorrect use of "random"

I'm trying to generate a random Positive in ada in my procedure. For this, I have the following code: procedure Inicialize(K: Positive) is package rand is new ada.numerics.discrete_random(Positive); use rand; G: Generator; t:…
lte__
  • 7,175
  • 25
  • 74
  • 131
1
vote
2 answers

Shortened method to reduce statements in an Ada procedure?

I am creating a procedure that uses an if statement to perform a decision. I have four variables: Altitude, Velocity, Angle and Temperature. The procedure is as follows: procedure Test3 is begin if (Integer(Status_System.Altitude_Measured)) >=…
DaveSwans
  • 57
  • 1
  • 2
  • 10