Re: accessing record element (question to the pros)



Norbert Caspari wrote:

n this example I try to
build a Union Record, where I can access a single Byte either as a small
positive Integer value or as single Bits.

In Pascal you needed this construct but Ada has Unchecked_Conversion to
perform this task.

In Ada a variant record is checked for consistency and you can't do it
because its inconsistence.

Suggested readings:

http://en.wikibooks.org/wiki/Ada_Programming/Subtypes#Converting_data
http://en.wikibooks.org/wiki/Ada_Programming/Types/record#Variant_record

And if you still want to do it: The newest GNAT has pragma Unchecked_Union.
You find a description in the texts above.

Martin
--
mailto://krischik@xxxxxxxxxxxxxxxxxxxxx
Ada programming at: http://ada.krischik.com
.