Questions tagged [ada2012]

Ada 2012 is the current standard of the Ada programming language.

Ada 2012 is the current standard (as define by ISO/IEC 8652:2012) of the Ada programming language.

New in Ada 2012

Contract-based Programming

  • Preconditions and postconditions define the expectations and obligations of a subprogram.
  • Type invariants specify boundary constraints for objects of an encapsulated (private) type.
  • Subtype predicates capture general constraints on data objects.

Concurrency and Multicore Support

  • Task affinities and dispatching domains allow tasks to be mapped to specific CPUs or cores.
  • Ravenscar for multiprocessor systems adapts a safe and widely used tasking profile to modern architectures.

Increased Expressiveness

  • Expression functions offer a convenient way to express simple functions.
  • Conditional expressions provide a compact notation for a common idiom.
  • Quantified expressions for universal and existential forms specify predicates over arrays and containers.

Container Enhancements

  • Bounded containers use stack allocation and do not incur the overhead of dynamic memory management.
  • Task-safe queues and priority queues provide efficient implementations of synchronized structures.
  • Holder containers create singleton structures for objects of an unconstrained type.
  • Iterators provide familiar idioms with uniform syntax to search and manipulate arrays and containers.

See more

40 questions
2
votes
1 answer

Ada records : detect lost bytes, propose optimisation

I'm working on an legacy Ada project with significant RAM constraints. In order to save memory for additional features, I would like to analyze all records definitions, in order to: detect holes (i.e. wasted bytes) propose a record declaration…
LoneWanderer
  • 3,058
  • 1
  • 23
  • 41
2
votes
1 answer

Wrapping an imported C pointer in an Ada tagged type of the same size

I'd like to replicate a C struct memory layout into an Ada type, and at the same time wrap the C fields (which are pointers) into tagged types that are at the same memory locations as the pointers to avoid extra memory use, while using dot notation…
Álex
  • 1,587
  • 11
  • 17
1
vote
1 answer

Ada2012: Assertion_Policy

According Ada2012 RM Assertion_Policy: 10.2/3 A pragma Assertion_Policy applies to the named assertion aspects in a specific region, and applies to all assertion expressions specified in that region. A pragma Assertion_Policy given in…
Albatros23
  • 297
  • 2
  • 14
1
vote
2 answers

Penultimate array index retrieval

Suppose the following generic procedure to print the elements of an array indexed by a discreet type (note the slight logic added to prevent the printing of an extra , past the end of the last element): with Ada.Text_IO; use Ada.Text_IO; with…
Sidisyom
  • 163
  • 5
1
vote
2 answers

How to make terminal input invisible in Ada?

I need to secure input passwords in an Ada command line application. Are there any ready to use functions/procedures in GNAT or third-party libraries?
khv2online
  • 100
  • 1
  • 7
1
vote
1 answer

How do I query PostgreSQL within GNAT CE 2019

I am trying to query a PostgreSQL database using GNAT CE 2019. I have two tables in my database, car and person: mydb1-# \dt List of relations Schema | Name | Type | Owner --------+--------+-------+---------- public | car |…
Lloyd Thomas
  • 345
  • 2
  • 12
1
vote
0 answers

Ada - aspect identifier expected

I've recently started using the gnatcoll, gnatcoll_sql, gnatcoll_postgres libraries within GNAT GPS Community Edition. My default.gpr file looks like this.. with "gnatcoll"; with "gnatcoll_postgres"; project Default is for Source_Dirs use…
Lloyd Thomas
  • 345
  • 2
  • 12
1
vote
1 answer

Use Ada's My_Class'Class(This) cast to mimic template method design pattern

Context I recently came into a basic OOP / Ada 2012 design issue. Basically, I have a parent class that realizes an interface contract. This is done in several steps inside an implementation provider (ConcreteX). A child class extends this…
LoneWanderer
  • 3,058
  • 1
  • 23
  • 41
1
vote
1 answer

Ada Tasking and Safety

I don't like coding but I really liked Ada, and I'm very new to it. So could you please clarify these points to me? If you have a computer with a single non-threaded CPU, tasking will still be single-CPU. The same of course applies to forking in C…
Matt
  • 11
  • 1
1
vote
1 answer

Understanding bounds of concatenated arrays in Ada 2012

I am reading Programming in Ada 2012 by John Barnes. In section 8.6 he discusses array concatenation and the rules for array bounds, in particular: The lower bound of the result depends on whether the underlying array type is constrained or…
Tod
  • 8,192
  • 5
  • 52
  • 93
1
vote
2 answers

How to Loop to Get an int from stdinput, ignoring white space

So I can easily grab the int value I am looking for from my .txt file through standard input but when there is a white space (or multiple white spaces) before it, it doesn't work and a data error occurs, Since its an integer though, my code below…
user2855405
  • 495
  • 2
  • 7
  • 20
1
vote
2 answers

Recursive visibility of symbols in Ada packages

Let's say I have a generic vector library. To make it easier to use, I want to instantiate various common forms of the vector library and make them visible in a single package. I'm trying this: with GenericVector; package Vectors is package…
David Given
  • 13,277
  • 9
  • 76
  • 123
0
votes
3 answers

Wrap-around Semantics for accessing Array Slices indexed by a Modular Type

I would like to create an array and access it in the following way for read and write slice operations (i.e. more than one element at once): If the indices are within range access them as usual If the second index is smaller than the first index,…
linux-fan
  • 353
  • 1
  • 8
0
votes
1 answer

How to install gprbuild on Linux - Centos7

I have recently dowloaded GNAT Community on my Linux machine (Centos7). Within /home/parallels/opt/GNAT/2019 there is a folder gprbuild, my understanding is that to install this I need to execute the bootstrap.sh script that is located within…
Lloyd Thomas
  • 345
  • 2
  • 12
0
votes
1 answer

Workaround "dynamic interface conversion not supported by configuration"

I have an object oriented design as follows (Ada 2012). The question is not about the design itself, but its consequences with a particular runtime profile. -- several packages ommitted here, ads/adb mixed together type Interface_A is…
LoneWanderer
  • 3,058
  • 1
  • 23
  • 41