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

How do I write the specification for a generic instantiation?

I'll start with the classic example of a generic procedure in Ada: ------------------------- -- swaps.ads ------------------------- package Swaps is generic type E is private; procedure Generic_Swap (Left, Right : in out E); end…
John Gowers
  • 2,646
  • 2
  • 24
  • 37
1
vote
3 answers

Porting to Itanium & Gnat Ada

An application developed in Ada 83 with OpenVMS platform is to be migrated to Itanium with GNAT Ada compiler. What are the risks of this port? Is there a general acceptance plan for the migration in a general way. How can I validated this…
1
vote
3 answers

convert fixed size array to record of same size

This might be a nobrainer but as a novice i can not get my head around it. I have a function returning a fixed size array. I am trying to convert this array into a record of the same size The function signature is like this: type Control is new…
Dreanaught
  • 71
  • 1
  • 10
1
vote
1 answer

Call to a volatile function in interfering context is not allowed in SPARK

I'm currently learning Ada during a university course on real-time programming languages and have a question about SPARK. I'm working on a project with a task that monitors an off-grid power supply. This task is crucial for machine safety and should…
Simon
  • 594
  • 1
  • 6
  • 13
1
vote
1 answer

Is there an Ada implementation of Google's protocol buffers?

I'm looking for an Ada implementation for protocol buffers. Looks like it's supported in just about any language except for Ada. I did find a PhD thesis describing development of Ada protocol buffers but I need a product (commercial, freeware,…
1
vote
2 answers

'Access attribute not allowed in generic body with external package

I'm having some issues with generics in Ada. Given the below example, gnatmake results in: g_package.adb:13:33: 'Access attribute not allowed in generic body g_package.adb:13:33: because access type "t_callback_p" is declared outside generic unit…
LordAro
  • 1,269
  • 3
  • 18
  • 35
1
vote
2 answers

How to rename an Ada constant defined in the private part

I want to rename a constant in the public part of a package (the original name is deprecated) that is defined in the private part. I tried this but GNAT says: full constant declaration appears too late package Sample is type The_Type is…
Gneuromante
  • 560
  • 3
  • 12
1
vote
3 answers

How does rendezvous work?

I am studying for an exam and am having a difficult time understanding Rendezvous. Here's an example I'm looking a While(1) { select{ when a == TRUE : accept A() {f1; b=FALSE} when b == TRUE : accept B() {f2; a=FALSE} else {a=true;…
JTai
  • 11
  • 1
  • 2
1
vote
2 answers

Ada `Gprbuild` Shorter File Names, Organized into Directories

Over the past few weeks I have been getting into Ada, for various different reasons. But there is no doubt that information regarding my personal reasons as to why I'm using Ada is out of scope for this question. As of the other day I started using…
D. Ataro
  • 1,711
  • 17
  • 38
1
vote
3 answers

gprbuild get external information into source

I am trying to have gprbuild automatically set some variables' values in my source code - one way or another. In particular I want the outputs of certain commands to be accessible from within the code. In C with Makefiles this is…
LambdaBeta
  • 1,479
  • 1
  • 13
  • 25
1
vote
1 answer

(Ada) weird blockage on Get from basic protected bounded buffer with 2 tasks

This is a very basic protected bounded buffer in Ada, exactly as it is presented everywhere, even in text books. (This is a part of a bigger thing, but I simplified code down to bare minimum, where it reproduced the behavior). It seems to work just…
1
vote
1 answer

Multiple random types in one Ada program?

In my Ada program I'd like to create two types of random: a random integer in a range and a random type I defined. In my example I have: type servizio is (piscina, spa, entrambi); type tempo is range 2..5; I tried to create the random instances as…
1
vote
1 answer

Why is Ada not raising a constraint error?

I have the following declaration of an anonymous subtype: testConstraint : Integer Range -5 .. 5; Then later, when assigning it: testConstraint := -6; Why am I not getting a Constraint_Error? Additional Details: There are no pragma suppress…
theMayer
  • 15,456
  • 7
  • 58
  • 90
1
vote
2 answers

Why might non-obvious "with" statements in the Ada Main File Causes Linking to Fail if Removed?

So, this is a bit of a crap shot, but I have a .gpr file that came as part of a legacy code package. There is a considerable amount of C and C++ code that is linked in during the build. By itself, the package works just fine. However, if I change…
theMayer
  • 15,456
  • 7
  • 58
  • 90
1
vote
3 answers

Hiding certain operators in Ada

Say I have the following type: type Example_Type is new Float; A large number of intrinsic operators will be defined for Example_Type, which is good in the overwhelming majority of cases. Like: function "+"(Left, Right : Example_Type) return…
Patrick Kelly
  • 633
  • 5
  • 22