Ada Programming/Attributes/'Size:3

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

A common Ada programming mistake is to assume that specifying 'Size for a type T forces the compiler to allocate exactly this number of bits for objects of this type. This is not true. The specified T'Size will force the compiler to use this size for components in packed arrays and records and in Unchecked_Conversion, but the compiler is still free to allocate more bits for stand-alone objects.

Use 'Size on the object itself to force the object to the specified value.