Ada Programming/Attributes/'Width
Description
X'Width is an Ada attribute where X is any discrete type. This attribute represents the number of characters it takes to represent the "longest" type value using the X'Image attribute.
Example
typeMy_Enumis(Big, Bigger, Biggest); ...pragmaAssert (My_Enum'Image (Biggest) = "BIGGEST" );pragmaAssert (My_Enum'Width = 7); -- Width of "BIGGEST" is seven -- Width of "BIG" and "BIGGER" are irrelevant.