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 to have multiple conditionals in an if statement in Ada

How would I go about having multiple conditionals in an if statement? Eg. The user is asked a set of questions by the program: 1.) Enter an altitude between 0 and 1000 (user types in data) 2.) Enter Velocity between 0 and 500 (user types in…
DaveSwans
  • 57
  • 1
  • 2
  • 10
1
vote
1 answer

Can't understand how generics work

I have a package called Linked_List(.ads) Here is the code in it: Generic type T is private; package Linked_List is type List is tagged record Data : T; end record; end Linked_List; and here is the code in the package which contains…
Planet_Earth
  • 325
  • 1
  • 3
  • 11
1
vote
1 answer

Achieving variable data coupling to a function in Ada (similar to static variables in functions in C)

Example in C, Static variables have a property of preserving their value even after they are out of their scope. Hence, static variables preserve their previous value in their previous scope and are not initialized again in the new scope. How can I…
Akay
  • 1,092
  • 12
  • 32
1
vote
1 answer

Ada GNAT.Sockets send on multiple ethernet adaptors?

I have a machine with 4 Ethernet Interfaces (ensf1s1, ensf1s2, ensf1s3, ensf1f4) and using GNAT.Sockets I need to be able to send/recieve data over each interface. The code I am using is Create_Socket(SendFrom1, Family_Inet,…
MattP
  • 2,798
  • 2
  • 31
  • 42
1
vote
1 answer

Passing structure from C to Ada

I need to pass a structure from C to Ada in an Ada binding application. Thus, I have declared the structure in both Ada and C so that both the source sides can decipher the structure composition. In C, typedef struct { int Status_Code; int…
Akay
  • 1,092
  • 12
  • 32
1
vote
2 answers

Errors while using Interfaces.C.Strings.Char_Array_Access

I am working on a C-ADA binding project where I need to pass a String declared in ADA side to C functions. In one of the ADA function, I declared a bounded char array as: Str_C : Interfaces.C.Char_Array(1..23) := (others => Interfaces.C.nul); And…
Akay
  • 1,092
  • 12
  • 32
1
vote
1 answer

Ada: How to represent a java string?

I need some tips/help with one of my home project in Ada. So i need to do a J_String_Package, but i don't really know how to represent my J_string type. The specification asks me to: "represent J_String type as an opaque discriminant record. For the…
DaniFreecs
  • 30
  • 6
1
vote
2 answers

using Carriage Return and Line Feed in an Ada if statement

I have a text file that I am splitting into two files. I am going through the input file line by line looking for CRLF, and with an if statement, performing an action when a CRLF is found. Here is a short snip-it of the input file with CRLFs. I…
Jeff Kyzer
  • 616
  • 2
  • 7
  • 14
1
vote
1 answer

Ada dependency graph

I need to create a dependency graph for a software suite that I am working on. In the past the company I work for has always done this manually, but I am guessing that there is a tool somewhere that will do what we need. The software I am working…
cwheat
  • 13
  • 2
1
vote
1 answer

Dynamic Dispatching in Ada with Access Types

I am trying to create a package that has Dynamic dispatching using access types. I have achieved Dynamic Dispatching using Class Types using This Q/A as a guide. I keep getting a compilation error that says: cannot call abstract subprogram. This…
Jerunh
  • 524
  • 5
  • 16
1
vote
1 answer

How can I get source code from Ada exe files?

Suppose I have a "hello world” program written in Ada: with Ada.Text_IO; -- Bibliothèque -- Déclaration de la procédure "Hello" procedure Hello is begin -- Imprimer "Hello, world!" à l'écran Ada.Text_IO.Put_Line("Hello, world!"); end…
ibra ibra
  • 21
  • 3
1
vote
1 answer

Delete a single character from the terminal in Ada

I'm writing a program with Ada, and it reads inputted numerical characters one character a time. I'm trying to simulate a backspace button, but I can't figure out a way to overwrite or remove a character that's already been placed on the screen. I…
JoPinsy
  • 217
  • 4
  • 14
1
vote
1 answer

Package with generic tagged

I want to realize queue manager example from "Ada Distilled" (2005) adapted for my job. Minimal needed code: package1.ads: with Ada.Finalization; use Ada; generic type Element is tagged private; package Lists is …
George
  • 78
  • 8
1
vote
3 answers

How to return an exit code from an Ada process to the calling Windows process?

I need to interface a Windows C++ program to a legacy GNAT Ada program. The Windows program spawns the legacy Ada program as a separate process and then waits for it to return. I can have the Ada main program written as a function that returns an…
JBabrick
  • 11
  • 1
1
vote
2 answers

Different scalar range in different cirumstance

How to represent data with complete scalar range in the first state then represent it as zero to one in the next state while using the same memory space? Any approaches to the problem is appreciated, the example procedures does not have to be like…
Jossi
  • 1,020
  • 1
  • 17
  • 28