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: Violation of "No_Exception_Propagation"

In the LED_Demo STM32 example project I have the following code (which compiles in GPS): procedure Does_Nothing is begin Null; exception when others => Null; end Does_Nothing; If I modify the same code to the code below, it does not…
John Leimon
  • 1,063
  • 1
  • 9
  • 13
1
vote
2 answers

How to use refs to constant Strings in arrays and records?

I am planning to convert some programs written in C/C++ to Ada. These make heavy use of constant char literals often as ragged arrays like: const char * stringsA = { "Up", "Down", "Shutdown" }; or string references in records like: typedef struct …
resander
  • 1,181
  • 2
  • 11
  • 15
1
vote
1 answer

In Ada, how do you change a constraint_error to a self-defined exception?

I am working with a linked list stack and I want it to get an Underflow error so I can see that it is working properly. It, however, keeps giving me a constraint error message where I want there to be the underflow message. Any tips on what to do…
j.Shry
  • 29
  • 5
1
vote
2 answers

AWS.Client raised PROGRAM_ERROR : aws-client.adb:543 finalize/adjust raised exception

I am trying to write a simple Ada (with AWS) program to post data to a server. The curl command is working as follows and return a valid response in JSON after successful login: curl -XPOST -d '{"type":"m.login.password", "user":"xxx", "password":…
Adrian Hoe
  • 2,081
  • 2
  • 12
  • 12
1
vote
1 answer

Out parameter undefined

I'm currently stuck in creating two tasks inside of a procedure adding numbers of an array passed to the respective procedure. My generic package looks like this: generic type Item_Type is private; with function "+"(Left: Item_Type; Right:…
hGen
  • 2,235
  • 6
  • 23
  • 43
1
vote
1 answer

Ada toolchain for Windows CE

Is there an Ada toolchain for Windows CE with a TI AM335X processor? If there is nothing "out of the box," is it possible to build GCC with Ada support for this platform?
Patrick
  • 2,243
  • 2
  • 23
  • 32
1
vote
3 answers

Ada : String legal value?

In Ada, can we give a string less characters than initially specified ? For example : Text : String(1..5); Text := "ada"; Is this code correct? Or are we obliged to give a 5 characters string? Thank you.
1
vote
2 answers

Ada. How to set task priorities at run-time?

First of all lets get this out of the way. I am a beginner in Ada, and the reason that I want to be able to do this is because I would like to program a Priority Inversion. I have included, with Ada.Task_Identification; I have also made a task…
David
  • 45
  • 1
  • 2
  • 7
1
vote
2 answers

Ada list running process in Linux

I am trying to write a program to control the processes that are running on the Linux system. I am interested in knowing the memory and CPU consumption of the processes and start, kill and pause the processes on the system. The nearest library I can…
Bharadwaj
  • 737
  • 6
  • 26
1
vote
1 answer

Ada: Index in for loop over an array range has unexpected value

PROBLEM STATEMENT I would like to iterate over every element in a matrix and display: The Element Value The Element Index (I, J) The code below gives me the following output: (-2147483648, -2147483648) = 1.00000E+00 (-2147483648, -2147483647) = …
John Leimon
  • 1,063
  • 1
  • 9
  • 13
1
vote
3 answers

List unused files in Gnat

I have a project in GNAT and I would like to list all the files that are never used. I am thinking about doing it with a python script, but, is it possible to do so easily with GNAT? Update: I found about gnatelim, but although in the help it says…
gccinac
  • 103
  • 2
  • 11
1
vote
2 answers

Getting variables from a line from a file

I was wondering if any of you could answer a quick question for me. I am currently working with records right now and in my program I need it to understand what the line of a file that i'm importing contains. My problem lies in the fact that I don't…
Dibs
  • 7
  • 5
1
vote
2 answers

Ada Modifying a variable address during runtime

I have an array and a variable declared like this NextPacketRegister : array (1 .. Natural (Size)) of Unsigned_32; PacketBufferPointer : Unsigned_32; for PacketBufferPointer'Address use To_Address (SPW_PORT_0_OUT_REG_ADDR); for…
Leo
  • 500
  • 5
  • 15
1
vote
1 answer

DllMain/DllMainCRTStartup does not execute in DLL

The initialization code in a DLL build with gnat is not running automatically when imported. I did a MCVE that consists on: division.ads with System; with Interfaces.C; package Division is --Neither of these work procedure DllMainCRTStartup…
gccinac
  • 103
  • 2
  • 11
1
vote
1 answer

Stream Read Blocking UDP GNAT

I have to receive UDP datagrams from a C++ client. The Client works correctly and send a datagram to the ip where i compile this code. Datagram's size is 800Bytes. When i send the datagram, the read process gets blocked. I have created this code…
eps_712
  • 135
  • 1
  • 2
  • 8