comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <stephen_leake@stephe-leake.org>
Subject: Re: Null Range in Unconstrasined Array
Date: Thu, 10 Sep 2009 19:24:40 -0400
Date: 2009-09-10T19:24:40-04:00	[thread overview]
Message-ID: <uvdjq758n.fsf@stephe-leake.org> (raw)
In-Reply-To: 51c7d71e-d71c-442c-aa47-55acb2ee0f6d@o9g2000yqj.googlegroups.com

sjw <simon.j.wright@mac.com> writes:

> On Sep 9, 9:35�am, Stephen Leake <stephen_le...@stephe-leake.org>
> wrote:
>> Adam Beneschan <a...@irvine.com> writes:
>> > To elaborate on this a bit further: Suppose you define a record type
>> > for reading a file with Ada.Direct_IO, that looks something like this:
>>
>> > � type Employee_Data is record
>> > � � � Name � � : String (1 .. 50);
>> > � � � Address1 : String (1 .. 40);
>> > � � � Address2 : String (1 .. 40);
>> > � � � City � � : String (1 .. 30);
>> > � � � State � �: String (1 .. 2);
>> > � � � ...
>> > � end record;
>
>> It _could_ depend on whether there's a pragma Pack, or a
>> representation clause, for the record. In the absence of such, I would
>> expect the compiler to treat these components the same way it treats
>> separate objects. Which means I would expect the bounds to be stored
>> with the object.
>
> After leaving out the ..., GNAT allocates 162 bytes for this record
> (no dope bytes). 

Ok, my expectations are duly updated :).

> Also, if you stream it, it takes just 162 bytes on the stream.

That's not surprising: LRM 13.13.2 says:

    3
    S'Write

         S'Write denotes a procedure with the following specification:

    4/2
              procedure S'Write(
                 Stream : not null access Ada.Streams.Root_Stream_Type'Class;
                 Item : in T)

    5
         S'Write writes the value of Item to Stream.


The value clearly does not include the bounds.

-- 
-- Stephe



      reply	other threads:[~2009-09-10 23:24 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-01  1:28 Null Range in Unconstrasined Array Rick
2009-09-01  3:11 ` Randy Brukardt
2009-09-01 14:50 ` Adam Beneschan
2009-09-01 15:34   ` Robert A Duff
2009-09-06 12:11     ` Peter C. Chapin
2009-09-06 12:41       ` Robert A Duff
2009-09-08 17:54         ` Adam Beneschan
2009-09-09  8:35           ` Stephen Leake
2009-09-09 13:00             ` Robert A Duff
2009-09-09 19:22             ` sjw
2009-09-10 23:24               ` Stephen Leake [this message]
replies disabled

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