# Ada Programming/Attributes

When entities like variables or subprograms are declared, certain properties thereof normally are left to the compiler to specify (like the size or the address of a variable, the calling convention of a subprogram). Properties which may be queried are called Attributes; those which may be specified are called Aspects. Aspects and attributes are defined in the Ada Reference Manual annex Annex K: Language-Defined Aspects and Attributes.

## Language summary attributes

The concept of attributes is pretty unique to Ada. Attributes allow you to get —and sometimes set— information about objects or other language entities such as types. A good example is the Size attribute. It describes the size of an object or a type in bits.
However, unlike the sizeof operator from C/C++ the Size attribute can also be set:
Of course not all attributes can be set. An attribute starts with a tick ' (apostrophe) and is followed by its name. The compiler determines by context if the tick is the beginning of an attribute, a character literal or a quantified expression.

## List of language defined attributes
### Ada 2005

    This is a new Ada 2005 attribute.

### Ada 2012

    This is a new Ada 2012 attribute.

### Ada 2022

    This is a new Ada 2022 attribute.

### Obsolescent

    This is a deprecated attribute and should not be used in new code.

### A – B

* 'Access
* 'Address
* 'Adjacent
* 'Aft
* 'Alignment
* 'Base
* 'Bit_Order
* 'Body_Version

### C

* 'Callable
* 'Caller
* 'Ceiling
* 'Class
* 'Component_Size
* 'Compose
* 'Constrained
* 'Copy_Sign
* 'Count

### D – F

* 'Definite
* 'Delta
* 'Denorm
* 'Digits
* 'Emax (Obsolescent)
* 'Enum_Rep (Ada 2022)
* 'Enum_Val (Ada 2022)
* 'Exponent
* 'External_Tag
* 'Epsilon (Obsolescent)
* 'First
* 'First_Bit
* 'Floor
* 'Fore
* 'Fraction

### G – L

* 'Has_Same_Storage (Ada 2012)
* 'Identity
* 'Image (Changed in Ada 2022)
* 'Index (Ada 2022)
* 'Input
* 'Large (Obsolescent)
* 'Last
* 'Last_Bit
* 'Leading_Part
* 'Length

### M

* 'Machine
* 'Machine_Emax
* 'Machine_Emin
* 'Machine_Mantissa
* 'Machine_Overflows
* 'Machine_Radix
* 'Machine_Rounding (Ada 2005)
* 'Machine_Rounds
* 'Mantissa (Obsolescent)
* 'Max
* 'Max_Alignment_For_Allocation (Ada 2012)
* 'Max_Size_In_Storage_Elements
* 'Min
* 'Mod (Ada 2005)
* 'Model
* 'Model_Emin
* 'Model_Epsilon
* 'Model_Mantissa
* 'Model_Small
* 'Modulus

### O – R

* 'Object_Size (Ada 2022)
* 'Old (Ada 2012)
* 'Output
* 'Overlaps_Storage (Ada 2012)
* 'Parallel_Reduce (Ada 2022)
* 'Partition_ID
* 'Pos
* 'Position
* 'Pred
* 'Preelaborate_Initialization (Ada 2022)
* 'Priority (Ada 2005)
* 'Put_Image (Ada 2022)
* 'Range
* 'Read
* 'Reduce (Ada 2022)
* 'Relative Deadline (Ada 2022)
* 'Remainder
* 'Result (Ada 2012)
* 'Round
* 'Rounding

### S

* 'Safe_Emax (Obsolescent)
* 'Safe_First
* 'Safe_Large (Obsolescent)
* 'Safe_Last
* 'Safe_Small (Obsolescent)
* 'Scale
* 'Scaling
* 'Signed_Zeros
* 'Size
* 'Small
* 'Storage_Pool
* 'Storage_Size
* 'Stream_Size (Ada 2005)
* 'Succ

### T – V

* 'Tag
* 'Terminated
* 'Truncation
* 'Unbiased_Rounding
* 'Unchecked_Access
* 'Val
* 'Valid
* 'Value
* 'Version

### W – Z

* 'Wide_Image (Changed in Ada 2022)
* 'Wide_Value
* 'Wide_Wide_Image (Ada 2005, changed in Ada 2022)
* 'Wide_Wide_Value (Ada 2005)
* 'Wide_Wide_Width (Ada 2005)
* 'Wide_Width
* 'Width
* 'Write

## List of implementation defined attributes

The following attributes are not available in all Ada compilers, only in those that had implemented them.
Currently, there are only listed the implementation-defined attributes of a few compilers. You can help Wikibooks adding specific attributes of other compilers:

### GNAT

    Implementation-defined attribute of the GNAT compiler from AdaCore/FSF.

### HP Ada

    Implementation-defined attribute of the HP Ada compiler (formerly known as "DEC Ada").

### ICC

    Implementation-defined attribute of the Irvine ICC compiler.

### PowerAda

    Implementation-defined attribute of OC Systems' PowerAda.

### SPARCompiler

    Implementation-defined attribute of Sun's SPARCompiler Ada.

### A – D

* 'Abort_Signal (GNAT)
* 'Address_Size (GNAT)
* 'Architecture (ICC)
* 'Asm_Input (GNAT)
* 'Asm_Output (GNAT)
* 'AST_Entry (GNAT, HP Ada)
* 'Atomic_Always_Lock_Free (GNAT)
* 'Bit (GNAT, HP Ada)
* 'Bit_Position (GNAT)
* 'CG_Mode (ICC)
* 'Code_Address (GNAT)
* 'Compiler_Key (SPARCompiler)
* 'Compiler_Version (GNAT, SPARCompiler)
* 'Constrained (GNAT)
* 'Declared (ICC)
* 'Default_Bit_Order (GNAT)
* 'Default_Scalar_Storage_Order (GNAT)
* 'Deref (GNAT)
* 'Descriptor_Size (GNAT)
* 'Dope_Address (SPARCompiler)
* 'Dope_Size (SPARCompiler)

### E – H

* 'Elaborated (GNAT)
* 'Elab_Body (GNAT)
* 'Elab_Spec (GNAT)
* 'Elab_Subp_Body (GNAT)
* 'Emax (GNAT)
* 'Enabled (GNAT)
* 'Entry_Number (SPARCompiler)
* 'Enum_Rep (GNAT)
* 'Enum_Val (GNAT)
* 'Epsilon (GNAT)
* 'Exception_Address (ICC)
* 'Extended_Aft (PowerAda)
* 'Extended_Base (PowerAda)
* 'Extended_Digits (PowerAda)
* 'Extended_Fore (PowerAda)
* 'Extended_Image (PowerAda)
* 'Extended_Value (PowerAda)
* 'Extended_Width (PowerAda)
* 'Extended_Wide_Image (PowerAda)
* 'Extended_Wide_Value (PowerAda)
* 'Extended_Wide_Width (PowerAda)
* 'Fast_Math (GNAT)
* 'Finalization_Size (GNAT)
* 'Fixed_Value (GNAT)
* 'From_Any (GNAT)
* 'Has_Access_Values (GNAT)
* 'Has_Discriminants (GNAT)
* 'Has_Tagged_Values (GNAT)
* 'High_Word (ICC)
* 'Homogeneous (SPARCompiler)

### I – N

* 'Img (GNAT)
* 'Initialized (GNAT)
* 'Integer_Value (GNAT)
* 'Invalid_Value (GNAT)
* 'Linear_Address (ICC)
* 'Large (GNAT)
* 'Library_Level (GNAT)
* 'Low_Word (ICC)
* 'Loop_Entry (GNAT)
* 'Machine_Size (GNAT, HP Ada)
* 'Mantissa (GNAT)
* 'Max_Integer_Size (GNAT)
* 'Max_Interrupt_Priority (GNAT)
* 'Max_Priority (GNAT)
* 'Maximum_Alignment (GNAT)
* 'Mechanism_Code (GNAT)
* 'Null_Parameter (GNAT, HP Ada)

### O – T

* 'Object_Size (GNAT)
* 'Old (GNAT)
* 'Passed_By_Reference (GNAT)
* 'Pool_Address (GNAT)
* 'Range_Length (GNAT)
* 'Ref (SPARCompiler)
* 'Restriction_Set (GNAT)
* 'Result (GNAT)
* 'Round (GNAT)
* 'Safe_Emax (GNAT)
* 'Safe_Large (GNAT)
* 'Safe_Small (GNAT)
* 'Scalar_Storage_Order (GNAT)
* 'Simple_Storage_Pool (GNAT)
* 'Small (GNAT)
* 'Small_Denominator (GNAT)
* 'Small_Numerator (GNAT)
* 'Storage_Unit (GNAT)
* 'Stub_Type (GNAT)
* 'System_Allocator_Alignment (GNAT)
* 'Target (ICC)
* 'Target_Name (GNAT)
* 'Task_ID (SPARCompiler)
* 'Tick (GNAT)
* 'To_Address (GNAT)
* 'To_Any (GNAT)
* 'Type_Class (GNAT, HP Ada)
* 'TypeCode (GNAT)
* 'Type_Key (SPARCompiler)

### U – Z

* 'UET_Address (GNAT)
* 'Unconstrained_Array (GNAT)
* 'Universal_Literal_String (GNAT)
* 'Unrestricted_Access (GNAT, ICC)
* 'Update (GNAT)
* 'VADS_Size (GNAT)
* 'Valid_Value (GNAT)
* 'Valid_Scalars (GNAT)
* 'Value_Size (GNAT)
* 'Wchar_T_Size (GNAT)
* 'Word_Size (GNAT)

## See also
### Wikibook

* Ada Programming
* Ada Programming/Aspects
* Ada Programming/Pragmas
* Ada Programming/Keywords

### Ada Reference Manual
#### Ada 83

* 4.1.4: Attributes
* Annex A: Predefined Language Attributes

#### Ada 95

* 4.1.4: Attributes
* Annex K: (informative) Language-Defined Attributes

#### Ada 2005

* 4.1.4: Attributes
* Annex K: (informative) Language-Defined Attributes

#### Ada 2012

* 4.1.4: Attributes
* Annex K: (informative) Language-Defined Aspects and Attributes

#### Ada 2022

* 4.1.4: Attributes
* Annex K: (informative) Language-Defined Aspects and Attributes

## References

* ↑ "4.2 ICC-Defined Attributes", ICC Ada Implementation Reference — ICC Ada Version 8.2.5 for i960MC Targets, document version 2.11.4