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

Error in Ada separate file

I am translating a Ada83 to Ada95 file. The problem happens when I try to compile a file which calls a separate. The error is "Illegal character " and refers to directive to preprocessor: with BAS_PUT; #if ADA_COMPILER="GNAT" then WITH…
Charles
  • 11
  • 2
1
vote
1 answer

Array traversal from a given index to the first

I've taken an Algorithm course in which the instructor has decided to use Ada as programming language tool to test our understanding. The argument was that ADA language is quite close to the Pseudo code that appears in CLRS book. Below code is a…
Amit
  • 327
  • 1
  • 4
  • 12
1
vote
3 answers

gdb and GPS: Cannot set a breakpoint on a function or procedure that is part of a protected type Ada object

I've got a protected object that presents functions and procedures in its interface. In gdb, when I set a bp on the first line of one of those, I get odd results. Here's a snippet from my gdb console: (gdb) (gdb) b…
Tom
  • 11
  • 1
1
vote
2 answers

Using a Variant Record by Pointer

I simply don't catch why the following does not work. Could someone help me to fix it? It complains (at runtime): raised CONSTRAINT_ERROR : variant2.adb:21 discriminant check failed procedure Variant2 is type POWER is (NONE,GAS, STEAM); type…
Patrick
  • 508
  • 2
  • 9
1
vote
2 answers

Dynamically linking ada runtime

I've installed GPS GPS 6.1.1 (20150118) hosted on i686-pc-mingw32 GNAT GPL 2015 (20150428-49). It successfully compiles Hello World, but even release executable is huge since it includes statically compiled not-optimized runtime and (what is more…
trbvm
  • 141
  • 7
1
vote
1 answer

put_Line is not visible and non-visible declaration at a-textio.ads error while compiling in Ada

I am trying to make a mergesort algorithm using Ada. I have to create a generic procedure and implement a parallel execution of the mergesort using tasks. But I am facing the following errors while compiling my code: mergesortproc.adb:92:17:…
ARYANX
  • 13
  • 6
1
vote
3 answers

Never use pre-defined real types?

I am starting to learn the Ada language by reading ADA Distilled. In chapter 3.8 It says: The Ada programmer never uses pre-defined real types for safety-critical, production quality software. I was wondering what this really implies and what…
gccinac
  • 103
  • 2
  • 11
1
vote
2 answers

Leading spaces while trying to print a number in Ada

I wrote a program which accepts an integer as input and prints the integer as output in Ada. When i run the program, it's printing the number but there are several leading white spaces. Does anybody know why it's happening? Here's the code: with…
Hans Solo
  • 53
  • 8
1
vote
1 answer

How to call a "C" function that is implemented in a ROM (or at an address) from ADA?

I have a question about a way to call a "C" function that is in a ROM, looking for a way to do this without involving link-time changes. For example, we know the "C" function: int my_func(int a); is located at address 0xFFFF_AAAA; so we try: type…
1
vote
2 answers

GNAT GPS IDE not binding and linking with strange error

I am trying to use GPS IDE as my alternative development tool on OS X El Capitan (moving away from OS X 10.5 Xcode 3.0). But I have stumbled on one strange error: gnat bind myprog.bexch gnatbind: Cannot find: myprog.bexch.ali gprbuild: unable to…
Adrian Hoe
  • 2,081
  • 2
  • 12
  • 12
1
vote
3 answers

How to use Ada 2012 user defined iterators?

Ada 2012 user defined iterator This feature allows user to make a custom iterator. Instead of writing Get (List, Index) one could write List (Index) and instead of writing for Index in 1 .. List.Max one could write for Index in List'Range. I am not…
Jossi
  • 1,020
  • 1
  • 17
  • 28
1
vote
1 answer

Use cairo with GTK

I want to draw geometric forms by code into a Gtk_Window . I already code the Gtk_window , my only problem is to use it with Cairo . Next, the code after using andlabs's method . So this code contain a gtk_drawing_area in the window , and the "draw"…
infinite
  • 63
  • 8
1
vote
2 answers

Ada initialization of controlled singleton variable

I am trying to create a package with a singleton variable that is auto initialized. If the singleton variable is not a controlled type, then the compiler doesn't complain, but when I make it controlled, I get the warning:"cannot call Initialize…
Victor
  • 35
  • 4
1
vote
1 answer

GNATprove: "postcondition might fail" in simple function

I want to write a simple function that finds the biggest number in given Integer array. Here is specification: package Maximum with SPARK_Mode is type Vector is array(Integer range <>) of Integer; function Maximum (A : in Vector) return…
1
vote
2 answers

compatibility of declared variables

I have here a question: 6. Ada supports named equivalence. Given the declaration: A: array(1..10) of integer; B: array(1..10) of integer; Are A and B compatible? What if we declare this as A, B: array(1..10) of integer; Are A and B compatible? Yet…
Ivy
  • 11
  • 1