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

How can I define a structure that will contain two multidimensional unconstrained arrays an pass it to a procedure

I am new to Ada so, I have a question: How can I define a structure that will contain two multidimensional unconstrained arrays an pass it to a procedure. Following the code that I have wrote: package SDR_Treatment is …
1
vote
1 answer

Ada: Task type as task mark in its own body

I have an Ada task, Do_Something, that needs to "invoke" itself. The way I think of it coming from C++, I have a thread running void Do_Something() and sometimes void Do_Something() needs to spawn more threads that also run void Do_Something(). Ada…
John Perry
  • 2,497
  • 2
  • 19
  • 28
1
vote
2 answers

Getters and setters Ada

I just started programming on Ada and I was wondering how to code getters and setters to work with classes attributes. In fact I am interested in obtaining getters and setters of attributes deadline, period and computingTime of the following…
thmasker
  • 406
  • 1
  • 9
  • 21
1
vote
2 answers

Illegal declaration in task definition

I have the following task specification: with Ada.Real_Time; use Ada.Real_Time; package pkg_task is task type task_t is activationTime : constant Integer := 1; period : constant Integer := 2; computingTime : constant…
thmasker
  • 406
  • 1
  • 9
  • 21
1
vote
1 answer

Ada put a task ready to terminate from entry point

I have a task that has only one Stop entry, and an else section, how can i implement that the task do the thing in the else section in an infinite loop but when Stop is called it is set ready to terminate here is the select part select accept…
BenJoe
  • 15
  • 3
1
vote
1 answer

Profiling GPRBuild

I have a large GPR based project that can take over 30 minutes to compile. Having analyzed the build process I noticed many obvious inefficiencies (multiple calls to gprbuild rather than aggregates, excessive use of alternative files rather than…
LambdaBeta
  • 1,479
  • 1
  • 13
  • 25
1
vote
2 answers

Ada Record Initialization: "Constraint_Error"

I'm trying to insert new elements in a record. I have default values set in the record and looked up how to initialize a record, but the compiler keeps saying, "warning: null value not allowed here," "warning: 'Constraint_Error' will be raised at…
NikonJR
  • 59
  • 7
1
vote
2 answers

How can I check to see if a element of an array exists in Ada

How can I check the to see if an element of an array exists in Ada. Also is there any good documented site for Ada like python's or php's documentation sites, so that I can search for all the types of functions and it's uses. I am not able to find…
Giri Dhar
  • 149
  • 2
  • 12
1
vote
2 answers

How do I declare a function in a C++ template delaration

In Ada I can define the following generic (Equivalent to a C++ template) : Generic With function Sum( .. ) return boolean Package XXXX is …… End package And later the generic can be instantiated as follows Package XXXX_1 is new XXXX( Sum =>…
1
vote
1 answer

generic object parameters are never considered static, how to use generic in mode object parameter then?

I have a generic object in mode parameter "Hexa_identifier", character type, which I would like to use in a case statement in the body of the generic unit. It seems I can't because generic object parameters are never considered static (RM 4.9(5)),…
1
vote
2 answers

Variant records: Use components multiple times

I created the following example code: type Category is (A, B, C); type My_Record (The_Category : Category) is record case The_Category is when A => A : Natural; when B => B : Integer; when C => …
Marcello90
  • 1,313
  • 4
  • 18
  • 33
1
vote
1 answer

Ada stop entry execution and execute other entry

I'm new to Ada and I'm trying to write a simple program but I have some issues I couldn't solve. So I have a task with an execute entry and a signalfound entry, the execute entry is being called first and has to do some calculations until the…
Ayk96
  • 69
  • 1
  • 1
  • 7
1
vote
2 answers

Looping through Ada arrays using strings

I have loaded some data from a file into three arrays of type Unbounded_String, which I'll call Days, Months, and Seasons. Each of these arrays has a corresponding Integer which has recorded the number of items in the array, viz. Days_Total,…
1
vote
1 answer

Do Ada 2012 implementations from AdaCore/FSF support spawning tasks arbitrarily?

TLDR: I am an idiot. It turns out that the library is for interfacing with OS spawned processes, not native Ada tasks. I recently stumbled across this library for spawning tasks arbitrarily and I was wondering if the feature that it implements for…
kuwze
  • 411
  • 4
  • 13
1
vote
1 answer

How to import #define constants from .h file to Ada?

I'm trying to move a constant from C to Ada that is located in a header file. file.h #define TEST 0x1234 How would I export this constant to ada? I know to export functions and import them into ada but I can't seem to figure out how to do the same…
Sterisk
  • 63
  • 9