Ada Programming/All Keywords

From Wikibooks, the open-content textbooks collection

Jump to: navigation, search

Augusta Ada King, Countess of Lovelace.
Augusta Ada King, Countess of Lovelace.

Contents

[edit] Keywords

[edit] Language summary keywords

Most Ada keywords have different functions depending on where they are used. A good example is for which controls the representation clause when used within a declaration part and controls a loop when used within an implementation.

In Ada, a keyword is also a reserved word, so it cannot be used as an identifier.

[edit] List of keywords


Ada Keywords
abort else new return
abs elsif not reverse
abstract end null
accept entry select
access exception of separate
aliased exit or subtype
all others synchronized
and for out
array function overriding tagged
at task
generic package terminate
begin goto pragma then
body private type
if procedure
case in protected until
constant interface use
is raise
declare range when
delay limited record while
delta loop rem with
digits renames
do mod requeue xor

[edit] See also

[edit] Wikibook

[edit] Ada 95 Reference Manual

[edit] Ada 2005 Reference Manual

[edit] Ada Quality and Style Guide


[edit] Keywords: abort

[edit] abort

The abort is used to abort either a task (thread) or partition (process).

[edit] See also

[edit] Wikibook

[edit] Ada Reference Manual

[edit] Ada Quality and Style Guide


[edit] Keywords: abs

This keyword is used for the operator that gets the absolute value of an integer number.

y := abs x;

[edit] See also

[edit] Wikibook

[edit] Ada 95 Reference Manual

[edit] Ada 2005 Reference Manual

[edit] Ada Quality and Style Guide


[edit] Keywords: abstract

[edit] Summary

The keyword abstract is used to define an abstract tagged type. See Ada Programming/Object Orientation for details on object orientation in Ada.

[edit] See also

[edit] Wikibook

[edit] Ada Reference Manual

[edit] Ada Quality and Style Guide


[edit] Keywords: accept

[edit] Summary

The keyword accept is used in Ada tasks for accepting a rendezvous.

[edit] See also

[edit] Wikibook

[edit] Ada Reference Manual

[edit] Ada Quality and Style Guide


[edit] Keywords: access

This keyword is used in access types declarations and anonymous access parameters.

[edit] See also

[edit] Wikibook

[edit] Ada Reference Manual

[edit] Ada Quality and Style Guide


[edit] Keywords: aliased

[edit] Description

If you come from C/C++ you are probably used to the fact that every element of an array, record and other variables has an address. The C/C++ standards actually demand that. In Ada this is not true.

Ada is a self optimizing language — there is for example no register keyword like in C/C++. Ada compilers will use a register for storage automatically. Incidentally, most C/C++ compilers nowadays just ignore the register and allocate registers themselves, just like Ada does.

So if you want to take an access from any variable you need to tell the compiler that the variable needs to be in memory and may not reside inside a register. This is what the keyword aliased is for. Additionally it also serves as a hint to the reader of the program about the existence of pointers referencing the variable.

[edit] For variables

I : aliased Integer := 0;

[edit] For type declarations

[edit] For the elements of an array

Declaring an array as aliased will only ensure that the array as a whole has an address. It says nothing about the individual elements of the array — which may be packed in a way that more than one element has the same address. You need to declare the actual elements as aliased as well. You can read in Types/array how this is done. Here is just a short example:

 type Day_Of_Month is range 1 .. 31;
 type Day_Has_Appointment is array (Day_Of_Month) of aliased Boolean;

[edit] For the elements of a record

Just like arrays, declaring a record as aliased will only ensure that the record as a whole has an address. It says nothing about the individual elements of the record — which again may be packed and share addresses. Again you need to declare the actual elements as aliased as well. You can read in Types/record how this is done. Here is just a short example:

type Basic_Record is
   record
      A : aliased Integer;
   end record;

[edit] See also

[edit] Wikibook

[edit] Ada Reference Manual

[edit] Ada Quality and Style Guide


[edit] Keywords: all

This keyword is used in:

[edit] See also

[edit] Wikibook

[edit] Ada Reference Manual

[edit] Ada Quality and Style Guide


[edit] Keywords: and

[edit] Logical operator