comp.lang.ada
 help / color / mirror / Atom feed
From: Martin Krischik <krischik@users.sourceforge.net>
Subject: Re: accessing record element (question to the pros)
Date: Fri, 24 Feb 2006 19:32:36 +0100
Date: 2006-02-24T19:32:36+01:00	[thread overview]
Message-ID: <1704363.KA6FmlD55X@linux1.krischik.com> (raw)
In-Reply-To: dtn78j$tdn$02$1@news.t-online.com

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@users.sourceforge.net
Ada programming at: http://ada.krischik.com



  parent reply	other threads:[~2006-02-24 18:32 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-24 15:03 accessing record element (question to the pros) Norbert Caspari
2006-02-24 15:27 ` Peter Hermann
2006-02-24 17:07 ` Norbert Caspari
2006-02-24 17:08 ` Alex R. Mosteo
2006-02-24 18:02 ` Jeffrey R. Carter
2006-02-24 19:04   ` Simon Wright
2006-02-24 21:46     ` Randy Brukardt
2006-02-26 11:49       ` many thanks to all the people who give me useful hints! Norbert Caspari
2006-02-28  0:33         ` Randy Brukardt
2006-02-24 18:32 ` Martin Krischik [this message]
2006-02-28 20:02   ` accessing record element (question to the pros) Matthew Heaney
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox