From: Georg Bauhaus <sb463ba@l1-hrz.uni-duisburg.de>
Subject: Re: Object with zero bits
Date: Thu, 14 Oct 2004 00:47:17 +0000 (UTC)
Date: 2004-10-14T00:47:17+00:00 [thread overview]
Message-ID: <ckkial$7hb$1@a1-hrz.uni-duisburg.de> (raw)
In-Reply-To: 2t5jo2F1s56mgU1@uni-berlin.de
Nick Roberts <nick.roberts@acm.org> wrote:
: Georg Bauhaus wrote:
:
:> : You can declare a record that will have zero bits size. Is this what
:> : you want?
:> :
:> : type Frame_Mark is null record;
:>
:> And maybe add a rep clause,
:>
:> type Nothing_At_All is null record;
:> for Nothing_At_All'size use 0;
:
: But many (perhaps most) compilers will make an object (or component) of
: type (subtype) Nothing_At_All at least size 1 (one bit).
An object of type Nothing_At_All can be 8 bits in size.
But Nothing_At_All as a record component seems to vanish,
type Num is limited record
virt: Nothing_At_All := initialize_Num(Num'access);
n: Natural;
end record;
pragma assert(Num'Max_Size_in_Storage_Elements = 4);
With suitable rep clauses, Boolean discriminants don't seem to consume
space in some variant records, when the compiler can find out :-)
next prev parent reply other threads:[~2004-10-14 0:47 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-13 6:15 Object with zero bits Robert C. Leif
2004-10-13 14:59 ` Nick Roberts
2004-10-13 15:18 ` Wojtek Narczynski
[not found] ` <ckjns1$342$1@a1-hrz.uni-duisburg.de>
[not found] ` <2t5jo2F1s56mgU1@uni-berlin.de>
2004-10-14 0:47 ` Georg Bauhaus [this message]
2004-10-14 2:14 ` Nick Roberts
2004-10-14 14:55 ` Georg Bauhaus
2004-10-14 8:13 ` Martin Krischik
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox