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

Why is there no multiple or block comment in Ada?

Why is there no multiple or block comment in Ada programming like the C/C++ /* */?
leuage
  • 566
  • 3
  • 17
15
votes
7 answers

Why has Ada no garbage collector?

I know GC wasn't popular in the days when Ada was developed and for the main use case of embedded programming it is still not a good choice. But considering that Ada is a general purpose programming language why wasn't a partial and optional (traces…
Lothar
  • 12,537
  • 6
  • 72
  • 121
13
votes
6 answers

Get the representation value of an enumeration type in Ada

I need to get the numeric value asociated with a value of an enumerated type in Ada. Not the position in the enumeration, but the value assigned with the "for TYPE use" clause to every value. Does anyone know if it is possible?
user1240854
  • 143
  • 1
  • 1
  • 5
13
votes
2 answers

how to get Ada exception message when catching from C++ handler?

Using GNAT Ada and Gnu C++, I'm interfacing an Ada piece of code with a c++ wrapper and I'd like to catch Ada exceptions properly when running this (stupid) code: with ada.text_io; package body ada_throw is procedure ada_throw is begin …
Jean-François Fabre
  • 137,073
  • 23
  • 153
  • 219
12
votes
4 answers

Are there any good Unit Test frameworks for Ada?

I come from a C++ background, but I'm currently working in Ada. In the C++ world, I unit test every class as I write it... this doesn't seem to be the vogue for our codebase here at work. I'd like to start implementing unit tests for the Ada…
oz10
  • 153,307
  • 27
  • 93
  • 128
12
votes
6 answers

Ada Shutdown Hook

There are some ‘cleanup’ calls that I want called when an Ada application is shutdown/killed. For instance if I was in java, I would do something like this to achieve the effect of having something called at…
mainstringargs
  • 13,563
  • 35
  • 109
  • 174
12
votes
1 answer

And then in the C++ conditional

Ada has nice feature of and then statement used in the if condition in addition to the Boolean and operator. This allows for checking if, e.g., the object is not null before accessing it like so: if Object /= null and then Object.Value > 5 then …
NeoSer
  • 527
  • 3
  • 16
12
votes
3 answers

Proving Floor_Log2 in Spark

New to Spark, and new to Ada, so this question may be overly broad. However, it's asked in good faith, as part of an attempt to understand Spark. Besides direct answers to the questions below, I welcome critique of style, workflow, etc. As my first…
11
votes
4 answers

Why is Ada not trapping this specified range check?

I am going through the learn.adacore.com tutorial and have hit upon a problem that I am unsure of. Specifically I understand that Ada is designed to trap attempts to overflow a variable with a specified range definition. In the case below, the first…
hypotenuse
  • 123
  • 6
11
votes
1 answer

Setting up a bare metal x86 Ada toolchain

Please forgive the somewhat broad question. I'm wondering how to create an Ada toolchain targeting bare-metal x86. I've seen Lucretia's Ada Bare Bones tutorial on osdev.org, which provides some useful information about building a suitable runtime…
ajxs
  • 3,347
  • 2
  • 18
  • 33
11
votes
5 answers

Quadratic equation in Ada

I just came around and decided to try some Ada. The downside is that the syntax and function strays quite away from C++. So I had to like cram various stuff to get this thing to work. My question is if there are some better way to do this…
starcorn
  • 8,261
  • 23
  • 83
  • 124
11
votes
1 answer

Cancel space after Integer'Image value in Ada

when I'm print this procedure below - procedure put (Date:Date_Type) is begin Put(Integer'Image(Date.Day)); --' Put("-"); Put(Integer'Image(Date.Month)); --' Put("-"); Put(Integer'Image(Date.Year)); --' end; The result is (for example) :…
firestruq
  • 719
  • 6
  • 15
  • 27
11
votes
2 answers

Loading Ada shared objects in Perl with DynaLoader.pm

Long time listener, first time caller. I'm aware this is a somewhat obscure question, and don't expect too much. :-) I have the following Ada files: greeter.ads package Greeter is procedure Hello; end Greeter; greeter.adb with Ada.Text_IO; use…
tobyink
  • 13,478
  • 1
  • 23
  • 35
10
votes
4 answers

Ada short-circuit control forms

Whats the meaning of x AND THEN y AND z is it x AND THEN (y AND z) (y, z gets never evaluated if x is FALSE) or (x AND THEN y) AND z (if x is FALSE, y is skipped, but its possible that z is evaluated) in ada?
10
votes
2 answers

System signal interception in Julia

In a Julia program which run under Linux, I need to launch a dedicated action when a console window is resized. So how in Julia, can I intercept the system signal SIGWINCH (window resizing) and attach to it a function which performs the required…
Emile
  • 163
  • 6