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.


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.


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]


GNAT Reference Manual[edit]