comp.lang.ada
 help / color / mirror / Atom feed
From: elroy.jpl.nasa.gov!sdd.hp.com!caen!uvaarpa!software.org!blakemor@ames.arc .nasa.gov  (Alex Blakemore)
Subject: Re: 'SIZE attribute of a type
Date: 13 Dec 91 16:00:55 GMT	[thread overview]
Message-ID: <1991Dec13.160055.23912@software.org> (raw)

In article <1991Dec13.152340.20444@software.org> smithd@software.org (Doug Smit
h) writes:
> If I have understood this thread, the following
> statement should minimize the storage for variables of type b:
>     for b'Size use b'Size;

Interesting idea.

> So I used a Verdix compiler (old) to see if it would even compile the
> code--it does!  But for a Boolean type it still uses 8:

> How many compilers can compile this and then how many actually
> use one bit for this type?  Very interesting...but cryptic.

Hi Doug,
  I ran this through our VMS Ada compiler and got the following.
I think you could read the LRM more than one way here.  Is there
an AI about this ? LRM excerpt is at the end.

--------------- Pruned listing from VAX Ada V2.2-38 --------------
    1   with Text_IO;
    2
    3   procedure Test_B is
    4
    5       type B is new Boolean;
    6       for B'Size use B'Size;
................1...........2
%ADAC-I, (2) The representation of type B at line 5 is forced here
%ADAC-E, (1) The representation of type B at line 5 has already been forced at 
line 6 [LRM 13.1(6)]
    7
    8       B_variable : B;
    9   begin
   10       Text_IO.Put_Line ("Type B has size              " &
   11                         Integer'Image (B'Size));
   12       Text_IO.Put_Line ("Variables of type B have size" &
   13                         Integer'Image (B_variable'Size));
   14   end Test_B;
--------------- end VAX Ada V2.2-38 listing --------------

For those unfamiliar with VMS, the messages preceeded with %ADAC-I
are informational messages which may help shed light on the subject 
but are not errors or even warnings.  Errors are preceeded with %ADAC-E.

LRM 13.1(6)
... certain occurrences of its name imply that the representation of the type
must already have been determined. ... A forcing occurrence is any occurrence
other than in a type or subtype declaration, or a representation clause for the
type itself. In any case, an occurrence within an expression is always forcing.
-- 
---------------------------------------------------------------------
Alex Blakemore           blakemore@software.org        (703) 742-7125
Software Productivity Consortium  2214 Rock Hill Rd, Herndon VA 22070

             reply	other threads:[~1991-12-13 16:00 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1991-12-13 16:00 Alex Blakemore [this message]
  -- strict thread matches above, loose matches on Subject: below --
1991-12-13 17:24 'SIZE attribute of a type elroy.jpl.nasa.gov!swrinde!zaphod.mps.ohio-state.edu!unix.cis.pitt.edu!ds
1991-12-13 15:23 agate!spool.mu.edu!yale.edu!qt.cs.utexas.edu!zaphod.mps.ohio-state.edu!ca
1991-12-12 22:49 Robert I. Eachus
1991-12-12 15:36 elroy.jpl.nasa.gov!sdd.hp.com!zaphod.mps.ohio-state.edu!unix.cis.pitt.edu
1991-12-12 15:18 elroy.jpl.nasa.gov!swrinde!mips!samsung!caen!umeecs!dip.eecs.umich.edu!wa
1991-12-12  3:17 Mark Biggar
1991-12-11 18:29 elroy.jpl.nasa.gov!swrinde!zaphod.mps.ohio-state.edu!unix.cis.pitt.edu!gv
1991-12-10 12:30 mcsun!uknet!yorkohm!minster!mjl-b
1991-12-10  8:23 paul goffin
1991-12-09 13:24 Ed Matthews
1991-12-07  0:32 Donald Gardner
1991-12-06 21:14 Ed Matthews
1991-12-06 21:07 Richard Pattis
1991-12-06 20:15 parkhill
1991-12-06 20:04 parkhill
1991-12-06 18:50 Brian Hanafee
1991-11-14 20:15 cis.ohio-state.edu!zaphod.mps.ohio-state.edu!mips!pacbell.com!iggy.GW.Vit
1991-11-14 19:58 cis.ohio-state.edu!zaphod.mps.ohio-state.edu!mips!pacbell.com!iggy.GW.Vit
1991-11-14 16:45 Danford Lehman
1991-11-13 17:01 elroy.jpl.nasa.gov!sdd.hp.com!mips!zaphod.mps.ohio-state.edu!unix.cis.pit
replies disabled

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