Ada Print Port_Type

Viewed 76

how to put_line Port_Type as defined in g-socket.ads:492, please?

Ada.Text_io.Put_Line ("Port: "  & Integer'Image(Port));

give me found type "Port_Type" defined at g-socket.ads:492 xxx.adb:121:51: expected type "Standard.Integer" Thanks BR Mark

1 Answers

You should be able to write

Ada.Text_IO.Put_Line ("Port: "  & Port'Image);

or, if you’re using an older GNAT,

Ada.Text_IO.Put_Line ("Port: "  & Port'Img);

’Image works for scalars; in Ada 2022 it works for composite types as well. There’s heavy stuff in ARM 2022 4.10, Image Attributes

Related