411 REFERENCE · Wikibooks
Ada Programming/Attributes/'Width
Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.
Attributes 'Width
__TOC__
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
type My_Enum is (Big, Bigger, Biggest);
...
Assert (My_Enum'Image (Biggest) = "BIGGEST" );
Assert (My_Enum'Width = 7);
Width of "BIGGEST" is seven
Width of "BIG" and "BIGGER" are irrelevant.
See also
Wikibook
Ada Programming
Ada Programming/Attributes
Ada Programming/Attributes/'Image
Ada Reference Manual
13 3 Operational and Representation Attributes
K Language-Defined Attributes
Width