Skip to content
Hub Nexus

No author yetClaim it

Version 1Updated 3 min read

Support

Computing » Computer Science » Computer Programming » Ada Programming

The Standard package is implicit. This means two things:

  • You do not need to with or use the package, in fact you cannot (see below). It's always available (except where hidden by a homograph, RM 8.3 (8) (Annotated)).
  • Standard may contain constructs which are not quite legal Ada (like the definitions of Character and Wide_Character).

A

  • with clause mentioning Standard references a user-defined package Standard that hides the predefined one. So do not do this. However any library unit hidden by a homograph can be made visible again by qualifying its name with Standard, like e.g. Standard.My_Unit.

Implementation

Since the package Standard is very important for portability, here are some examples for various compilers:

The package Standard from ISO 8652.

Portability

The only mandatory types in Standard are Boolean, Integer and its subtypes, Float, Character, Wide_Character, Wide_Wide_Character, String, Wide_String, Wide_Wide_String, Duration. There is an implementation permission in RM A.1 [Annotated](51) that there may be more integer and floating point types and an implementation advice RM A.1 [Annotated](52) about the names to be chosen. There even is no requirement that those additional types must have different sizes. So it is e.g. legal for an implementation to provide two types Long_Integer and Long_Long_Integer which both have the same range and size.

Note that the ranges and sizes of the numeric types can be different in every platform. There is an implementation requirement that the size of type Integer is at least 16 bits, and that of Long_Integer at least 32 bits (if present) RM 3.5.4 [Annotated](21..22). There is also an implementation permission RM 3.5.4 [Annotated](25) that further types whose names indicate smaller ranges like Short_Integer (if present) do not in fact have ranges greater than those indicating larger ranges. There is, however, an implementation advice RM 3.5.4 [Annotated](28) that there should be no other integer types in Standard than Integer and Long_Integer; instead, those hardware adapted types should be defined in package Interfaces RM B.2 [Annotated]. So if you want full portability of your types, do not use types from Standard (except where you must, see below), rather define you own types. A compiler will reject any type declaration whose range it cannot satisfy.

This means e.g. if you need a 64-bit type and find that with your current implementation Standard.Long_Long_Integer is such a type, when porting your program to another implementation, this type may be shorter, but the compiler will not tell you - and your program will most probably crash. However, when you define your own type like

then, when porting to an implementation that cannot satisfy this range, the compiler will reject your program.

The type Integer is mandatory when you use [[wide] wide] strings or exponentiation x**i. This is why some projects even define their own strings, but this means throwing out the child with the bath tub. Using Integer with strings and exponentiation will normally not lead to portability issues.

See also

Wikibook

Ada Programming

Ada Reference Manual

Ada Quality and Style Guide

Where this page came from

This page was imported from Wikibooks. From “Ada Programming” on Wikibooks, by its contributors, under CC BY-SA 4.0. Changed here: set as a page; navigation and edit links left out; each image under its own licence, credited in its caption.

Nobody has written it yet — it is the source material at a new address, which is why search engines are asked to skip it and why no one earns from it. It is up for grabs: take it on, and it is yours to rewrite and to earn from.

Comments

Spinner Logo

Next in Ada Programming

CC BY-SA 4.0
[Computing]( » [Computer Science]( » [Computer Programming]( » [Ada Programming]( The **Ada** package is only an anchor or namespace for Ada's standard library. Most compilers will not allow you to add new packages to the Ada hierarchy and even if your compiler allows it you should not do so since a
CC BY-SA 4.0
[Computing]( » [Computer Science]( » [Computer Programming]( » [Ada Programming]( The Interfaces package helps in interfacing with other programming languages. Ada is one of the few languages where interfacing with other languages is part of the language standard. The language standard defines the i
CC BY-SA 4.0
[Computing]( » [Computer Science]( » [Computer Programming]( » [Ada Programming]( ## Forges of open-source projects [SourceForge]( Currently, there are more than 200 Ada projects hosted at SourceForge — including the example programs for [Ada Programming]( wikibook. [GitHub]( A source code repositor
CC BY-SA 4.0
Some of them are used as [attribute]( names. ## List of keywords | Ada Keywords | | | | | | --- | --- | --- | --- | --- | | abort | else | new | return | | | abs | elsif | not | reverse | | | abstract (Ada 95) | end | null | | | | accept | entry | | select | | | access | exception | of | separate |
CC BY-SA 4.0
Operators have arguments which in the RM are called Left and Right for binary operators, Right for unary operators (indicating the position with respect to the operator symbol). The list is sorted from lowest precedence to highest precedence. ### Logical operators [and]( and $x ∧ y$, (also keyword [
CC BY-SA 4.0
[Computing]( » [Computer Science]( » [Computer Programming]( » [Ada Programming]( This is an overview of the major features that are available in **Ada 2005**, the version of the Ada standard that was accepted by ISO in January 2007 (to differentiate it from its predecessors [Ada 83]( and [Ada 95](