Ada Programming/Keywords/for
This keyword is used in:
- For loops
- Representation clauses:
- attribute definition clause
- enumeration representation clause
- record representation clause
- at clause (obsolescent)
- Quantified expressions
- Universal quantification
- Existential quantification
Nowadays representation clauses are formally called aspect clauses in the last versions of the Reference Manual due to some technicalities, although representation clauses is the name far more extended among Ada programmers. As a historical note, they were known as representation specifications (rep specs) in pre-Ada 83 proposals.[1]
For loops
↑Jump back a sectionRepresentation clauses
Attribute definition clause
for id'attribute use value;
Where attribute can be any specifiable attribute.
Enumeration representation clause
for enumeration type use (enum1 => value1, enum2 => value2, ...);
Record representation clause
for record type use record component1 at offset range first bit 1 .. last bit 1; component2 at offset range first bit 2 .. last bit 2; ... end record;
At clause (obsolescent)
At clauses are obsolescent since Ada 95:
for id use at address;
where address is of the type System.Address.
An at clause is equivalent to "for id'Address use address;". Since Ada 95 this is the preferred method.
Quantified expressions
This language feature is only available in Ada 2012.
Universal quantification
Universal quantification expression:
(for all var in range => predicate)
Existential quantification
Existential quantification expression:
(for some var in range => predicate)
See also
Wikibook
Ada Reference Manual
- 2.9 Reserved Words (Annotated)
- Annex P (informative) Syntax Summary (Annotated)
- 5.5 Loop Statements (Annotated)
- 13.3 Operational and Representation Attributes (Annotated)
- 13.4 Enumeration Representation Clauses (Annotated)
- 13.5.1 Record Representation Clauses (Annotated)
- Annex J.7 At Clauses (Annotated) (obsolescent)
Ada 83
- 13.5: Address Clauses (obsolescent)
Ada Quality and Style Guide
References
- ↑ John Barnes (2003-03-25). High-Integrity Software — The SPARK Approach to Safety and Security. Addison-Wesley. ISBN 0-321-13616-0. http://www.praxis-his.com/sparkada/sparkbook.asp. Retrieved 2008-06-06. "Representation clauses are now strictly known as aspect clauses — the name was changed in the 2000 Corrigendum for Ada 95 for subtle reasons that need not concern us; Ada historians might recall that they were known as representation specifications (rep specs) prior to the ANSI standardization in 1983. These various terminologies are all in use and the reader will encounter them in the literature. (pp.212–213)"
| Ada Keywords | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|