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
0
votes
1 answer

Expression for finding an index in an array

How can I find the first character in a string that is the space character and return its index, with a single expression that can be used as part of Contract_Cases? For example, if the string is: Input : constant String := "abc def"; then the…
rid
  • 61,078
  • 31
  • 152
  • 193
0
votes
1 answer

Determining why an Ada assertion failed

If an assertion fails, I get the following output: raised SYSTEM.ASSERTIONS.ASSERT_FAILURE : Dynamic_Predicate failed at file.adb:36 Can I get any more details? For example what the input was, or maybe a stack trace, or anything else that might…
rid
  • 61,078
  • 31
  • 152
  • 193
0
votes
1 answer

Describing a String type in Ada

I have a type similar to: type ID is new String (1 .. 7); -- Example: 123-456 How can I specify that format in code, either with Ada or SPARK? I was thinking about Static_Predicate, but the condition that the string must start with 3 positive…
rid
  • 61,078
  • 31
  • 152
  • 193
0
votes
2 answers

In Ada, How do I recursively map and memory manage a type within itself

I've been struggling with this little issue for a while. I am trying to create my own implementation of an internal JSON structure. The challenge is that with Ada I have to use an access type to make it recursive and access types have the risk of…
Micah W
  • 378
  • 2
  • 8
0
votes
1 answer

Ada 2012 and the GNAT GPS IDE Debugger Can't Find Source File

I'm working with a simple hello world single .adb file program in Ada 2012 using the GPS IDE under Windows 7/64. If I keep all the object and source files together everything works. I did have to go to the project properties Switches tab and select…
Tod
  • 8,192
  • 5
  • 52
  • 93
0
votes
1 answer

Ada for loop isn't doing correct comparison

The simple program is to match the best candidate for a voter with several candidates. There are 10 imaginary topics which the imaginary voter answered; a "-1" means disagreement, a "0" means doesn't care, a "1" means agreement. The candidates also…
Honinbo Shusaku
  • 1,411
  • 2
  • 27
  • 45
0
votes
1 answer

Unnamed records in Ada

In Java, you would be able to do something like this: ArrayList.add(new Object(int arg1, int arg2); creating an object without a name and adding it to a list, making it easy to use in a loop. How would I do similar in Ada using records? I have a…
Amandeep
  • 11
  • 3
0
votes
3 answers

How to add different type values to an array in Ada?

My goal is to receive from standard input an equation, store that in an array for later use/re-printing, then output a line printing the whole equation AND the answer after just like so: Input: 2+3= Output: 2 + 3 = 5 I am very confused on how to go…
user2855405
  • 495
  • 2
  • 7
  • 20
0
votes
2 answers

How to loop through multiple data sets from standard input

I am reading from standard input (a text file and doing calculations with the data which is lined up like this: 2 --This states the amount of following sets of info 150 -- this is the first set of data 250 -- this is the second set of data 0 --…
user2855405
  • 495
  • 2
  • 7
  • 20
0
votes
0 answers

Generic Subprogram taking type from a package implementing Ada.Iterator_Interfaces to take advantage of Ada 2012 for .. in/of loop syntax

As I understand from here anything that implements Ada.Iterator_Interfaces can use the Ada 2012 for loop syntax. "for ... [in|of] .. loop .. end loop; How do I create a generic subprogram that I can instantiate with a type in a package that…
Matt
  • 134
  • 15
1 2
3