comp.lang.ada
 help / color / mirror / Atom feed
From: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Subject: Re: Efficient Matrix?
Date: 28 Dec 2002 17:19:40 GMT
Date: 2002-12-28T17:19:40+00:00	[thread overview]
Message-ID: <slrnb0rn9c.7cr.adi@drcomp.erfurt.thur.de> (raw)
In-Reply-To: wccn0mqqgng.fsf@shell01.TheWorld.com

Robert A Duff <bobduff@shell01.TheWorld.com> wrote:

>> > Compilers are required to pack tightly in this case (one bit per Boolean
>> > component).  I.e., Matrix'Component_Size will be 1 if there's a pragma
>> > Pack.  See RM-13.2(9).
>> Hmm?
> Looks like a compiler bug to me.  

Not really.

    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.

"should be less than or equal", so gnat is RM-conformable here, but
the important question is why the representation-clause is not
respected. I guess, the answer is in RM-13.1(21):

   22  An implementation need not support representation items
       containing nonstatic expressions, except that an implementation
       should support a representation item for a given entity if each
       nonstatic expression in the representation item is a name that
       statically denotes a constant declared before the entity.

   23  An implementation need not support a specification for the Size
       for a given composite subtype, nor the size or storage place for
       an object (including a component) of a given composite subtype,
       unless the constraints on the subtype and its composite
       subcomponents (if any) are all static constraints.

And it looks like that "Positive range <>" is not static. In fact,
it is unconstrained.

> It seems to me that RM-13.2(9) implies packed arrays of Boolean have 
> 'Component_Size = 1.  Don't you think so?

No. For static arrays this would be right because 1 bit f�r Boolean is
smallest packing. This will happen if you say something like

  type static_array is (1 .. 64) of Boolean;
  pragma Pack (static_array);

which should return static_array'Size=64, implying Component_Size=1.

But the other paragraphs in Section 13 permit the compiler to neglect
all nonstatic expressions.

>> adi@drcomp:/tmp$ ./bla
>>  8
>>  8
>> adi@drcomp:/tmp$
> So what size is A.all?

10000*5000*8 bits.


-- 
mail: adi@thur.de  	http://adi.thur.de	PGP: v2-key via keyserver

Ausgerottet ist die Pest, das macht doch nichts, es gibt doch West.



  reply	other threads:[~2002-12-28 17:19 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 [this message]
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
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