Skip to content
Hub Nexus

No author yetClaim it

Version 1Updated 4 min read

Support

Computing » Computer Science » Computer Programming » Ada Programming

Summary

The pragma Restrictions is used to forbid the utilization of some language features.

List of language defined restrictions identifiers

Some restrictions are specially marked:

Ada 2005
This is a new Ada 2005 restrictions identifier.
Ada 2012
This is a new Ada 2012 restrictions identifier.

List of implementation defined restrictions identifiers

The following restrictions are not available in all Ada compilers, only in those that had implemented them:

GNAT
This is an implementation defined restriction identifier of the GNAT compiler.

"Hello, world!" with restrictions

The following sample demonstrates the use of pragma Restrictions. Note that on Windows, Linux and macOS the given restrictions won't change the generated code.

File: hello_world_restricted.adb, Crate: pragmas_restrictions (view, plain text, download with Alire, Alire crate info)

Nuvola-inspired-terminal

(Image: Varnent, CC BY-SA 3.0)

Code:

pragma Restrictions (
Simple_Barriers,
No_Abort_Statements,
No_Asynchronous_Control,
No_Calendar,
No_Delay,
No_Dynamic_Attachment,
No_Dynamic_Priorities,
No_Enumeration_Maps,
No_Entry_Calls_In_Elaboration_Code,
No_Entry_Queue,
No_Exception_Registration,
No_Initialize_Scalars,
No_Local_Protected_Objects,
No_Protected_Type_Allocators,
No_Protected_Types,
No_Relative_Delay,
No_Requeue_Statements,
No_Select_Statements,
No_Streams,
No_Task_Allocators,
No_Task_Attributes_Package,
No_Task_Hierarchy,
No_Task_Termination,
No_Tasking,
No_Terminate_Alternatives,
No_Wide_Characters,
Static_Priorities,
Static_Storage_Size,
Immediate_Reclamation,
No_Implementation_Restrictions,
Max_Protected_Entries => 0,
Max_Protected_Entries => 0,
Max_Select_Alternatives => 0,
Max_Task_Entries => 0,
Max_Tasks => 0,
Max_Asynchronous_Select_Nesting => 0);

with Ada.Text_IO;

procedure Hello_World_Restricted is
begin
Ada.Text_IO.Put_Line ("Hello World!");
Ada.Text_IO.New_Line;
Ada.Text_IO.Put_Line ("This is a program with restricted runtime.");
end Hello_World_Restricted;

Output:

>alr run hello_world_restricted
ⓘ Building pragmas_restrictions=1.0.1/pragmas_restrictions.gpr...
Compile
[Ada] hello_world_restricted.adb
Bind
[gprbind] hello_world_restricted.bexch
[Ada] hello_world_restricted.ali
Link
[link] hello_world_restricted.adb
✓ Build finished successfully in 0.83 seconds.
Hello World!

This is a program with restricted runtime.

See also

Wikibook

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 **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)](
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 [