comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: Efficient Matrix?
Date: Sat, 28 Dec 2002 23:42:33 GMT
Date: 2002-12-28T23:42:33+00:00	[thread overview]
Message-ID: <wccd6nld82e.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: slrnb0s84c.9ge.adi@drcomp.erfurt.thur.de

Adrian Knoth <adi@drcomp.erfurt.thur.de> writes:

> Robert A Duff <bobduff@shell01.TheWorld.com> wrote:
> 
> > turns it into a binding requirement.  13.1(20) also mentions this.
> 
> ACK.
>
> > So a standards conforming compiler can get away without supporting any
> > representation items at all.  But a compiler that claims to support the
> > SP annex must obey 13.2(9).  
> 
>     9  For a packed array type, if the component subtype's Size is less
>        than or equal to the word size, and Component_Size is not
>        specified for the type, Component_Size should be less than or
>        equal to the Size of the component subtype, rounded up to the
>        nearest factor of the word size.
> 
> How does this _forces_ a compiler to set a packed boolean array's
> Component_Size to 1? As I understand the paragraph it determines
> the compiler's behaviour if the Component_Size of a packed array is
> _not_ defined by the user.

I guess I was talking about that case.  E.g:

    type T is array (Positive range <>) of Boolean;
    pragma Pack(T);

The component subtype is Boolean.

Boolean'Size = 1, by 13.3(49).  Also 13.3(55), combined with the SP
annex thing.

This size (1 bit) is <= word size on every machine.  And it's a factor
of the word size on every machine.  So the compiler must choose
T'Component_Size <= 1.  And it can't very well choose < 1, so it must
choose = 1.

If you specify T'Component_Size, then the above paragraph is saying that
overrides the pragma.  So if you say:

    type T is array (Positive range <>) of Boolean;
    pragma Pack(T);
    for T'Component_Size use 2;

then T'Component_Size = 2.  This is required to be supported by
13.3(73), combined with the SP annex thing, assuming the word size
is an even number of bits (which is quite common ;-)).

> I guess I'll send a bug-report. Unfortunately the gcc-bug-database is
> write-only at the moment, so to say, there seems to be nobody carrying
> much about ProblemReports. 

Unless you're a paying customer, they have no obligation to fix things
soon.  But they do seem to fix things "eventually".

- Bob



  reply	other threads:[~2002-12-28 23:42 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <3e0b2a66_4@news.bluewin.ch>
2002-12-26 22:09 ` Efficient Matrix? Adrian Knoth
2002-12-27  0:23   ` Alvery Grazebrook
2002-12-27  9:53     ` Adrian Knoth
2002-12-27 16:58       ` Robert A Duff
2002-12-28  1:44         ` Nick Roberts
2002-12-28 13:00         ` Adrian Knoth
2002-12-28 15:21           ` Bill Findlay
2002-12-28 15:48             ` Adrian Knoth
2002-12-28 23:26               ` Adrian Knoth
2002-12-28 16:07             ` Robert A Duff
2002-12-28 17:25               ` Bill Findlay
2002-12-28 17:35                 ` Bill Findlay
2002-12-28 20:51                 ` Robert A Duff
2002-12-28 15:58           ` Robert A Duff
2002-12-28 17:19             ` Adrian Knoth
2002-12-28 19:16               ` James S. Rogers
2002-12-28 20:45               ` Robert A Duff
2002-12-28 22:07                 ` Adrian Knoth
2002-12-28 23:42                   ` Robert A Duff [this message]
2002-12-27 12:25 ` Gautier
replies disabled

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