Ada Programming/Attributes/'To Address

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Ada. Time-tested, safe and secure.
Ada. Time-tested, safe and secure.

Description[edit | edit source]

System'To_Address (X) is a GNAT specific attribute with the same purpose of function System.Storage_Elements.To_Address. The only difference is that it can be used in preelaborated units where non-static calls are not allowed. X is a value of that type System.Storage_Elements.Integer_Address (an implementation-defined integer type), and note that this attribute is not applied to the type of X but always to package System.

Example[edit | edit source]

Using the standard Ada To_Address function:

for Sensor'Address use System.Storage_Elements.To_Address (16#0FF2_1234#);

Using the GNAT specific To_Address attribute:

for Sensor'Address use System'To_Address (16#0FF2_1234#);

See also[edit | edit source]

Wikibook[edit | edit source]

GNAT Reference Manual[edit | edit source]