From: Petter <petter_fryklund@hotmail.com>
Subject: Re: Rep Specing Variant Records
Date: Wed, 16 Sep 2009 01:19:54 -0700 (PDT)
Date: 2009-09-16T01:19:54-07:00 [thread overview]
Message-ID: <d8bc1b01-82fa-4424-9b13-52c429bcd059@j19g2000vbp.googlegroups.com> (raw)
In-Reply-To: 2009091520225816807-rblove@airmailnet
Yes, discriminants do take up size.
This is how I would do it:
type Stuff (Has_Extra : Boolean) is record
Foo : Integer;
Bar : Integer;
case Has_Extra is
when True =>
Blah : Float;
when False =>
null;
end case;
end record;
for Stuff use record
Has_Extra at 0 range 0 .. 31;
Foo at 4 range 0 .. 31;
Bar at 8 range 0 .. 31;
Blah at 12 range 0 .. 31;
end record;
type Other_Stuff (Has_Blah : Boolean) is record
Foo : Integer;
Bar : Integer;
case Has_Blah is
when True =>
Blah : Float;
when False =>
Blip : Integer;
end case;
end record;
for Other_Stuff use record
Has_Blah at 0 range 0 .. 31;
Foo at 4 range 0 .. 31;
Bar at 8 range 0 .. 31;
Blah at 12 range 0 .. 31;
Blip at 12 range 0 .. 31;
end record;
next prev parent reply other threads:[~2009-09-16 8:19 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-16 1:22 Rep Specing Variant Records R.B. Love
2009-09-16 8:19 ` Petter [this message]
2009-09-16 10:10 ` Martin
2009-09-16 15:03 ` Adam Beneschan
2009-09-17 2:39 ` Robert Love
2009-09-17 6:57 ` Niklas Holsti
2009-09-17 8:25 ` Martin
2009-09-18 2:28 ` Robert Love
2009-10-10 2:49 ` Randy Brukardt
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox