comp.lang.ada
 help / color / mirror / Atom feed
From: ajpo!dlehman@sei.cmu.edu  (Danford Lehman)
Subject: Re: 'SIZE attribute of a type
Date: 14 Nov 91 16:45:46 GMT	[thread overview]
Message-ID: <811@ajpo.sei.cmu.edu> (raw)

In article 6171, Robert Parkhill answers Donald Gardner's query re why his
compiler's CHARACTER'SIZE = 8 vs. 7; the following excerpt from Commentary
AI-00536, which is ARG & WG9 approved, addresses the points raised by the
two articles and shows part of Mr. Parkhill's response to be incorrect.
Whether there will be any further change to the Ada83 ACVC test suite in
order to check for recently resolved representation issues is in question
--validation testing for Ada83 implementations might have ceased (i.e., no
new ACVC, no successive validation cycle--certificates extended 'til 1994!).
Under the current test suite, ACVC 1.11, some implementations indeed did not
have BOOLEAN'SIZE = 1 and thus failed some tests (they were advised of the
Commentary and not permitted these failures, and so presumably they changed
their attribute's value).

---Dan LEHMAN
-------------- *

-------------------------------------------------------------------------------
  The meaning of 'SIZE applied to a type, subtype, or object     AI-00536/08  1
  90-07-06                                                               BI  WA


| !standard 13.07.02 (05)                                 90-07-06  AI-00536/08
  !standard 13.02    (05)
  !class binding interpretation 88-11-08
| !status WG9-approved 90-06-15
  !status ARG-approved 89-10-25 (reviewed)
  !status ARG-approved (8-0-1) 89-06-14 (pending editorial review)
  !status ARG-approved (10-0-0) 89-02-28 (pending editorial review; ballot)
  !status work-item 89-01-30
  !status received 87-04-13
  !references AI-00551, AI-00554, AI-00555, AI-00561, AI-00825, 83-00914,
              83-00965, 83-00994, 83-00997, 83-01023, 83-01024
  !topic The meaning of 'SIZE applied to a type, subtype, or object

  !summary 89-07-28

  'SIZE  applied  to  an  object  yields  the  number of bits allocated for the
  object.  (This number may include padding bits that are part  of  the  stored
  value.)    (See  AI-00825  for  the value of 'SIZE applied to an object of an
  unconstrained subtype with discriminants.)

  If the size of a type or a first named subtype T  has  been  specified  by  a
  length  clause,  then T'SIZE yields the specified size, and the size of every
  subtype of T is also this value.

  If the size of a type or a first named subtype has been specified by a length
  clause,  then  an  object  of the type or any of its subtypes is allocated at
  least the specified number of bits, unless the object is  a  component  of  a
  record  and  the  component's  size has been determined by a record component
  clause (see AI-00551).  (Hence, every object of such a type has at least  the
  specified size except when a smaller size has been determined explicitly by a
  record component clause.)

  If the size of a type or a subtype S has not  been  determined  by  a  length
  clause  and  S  is  either  a  scalar subtype, a constrained array subtype, a
  constrained subtype with discriminants, an access type, a  task  type,  or  a
  private  type  whose  full type is one of these types, then S'SIZE yields the
  smallest number of bits that an implementation will allocate  for  an  object
  declared with the subtype indication S; objects whose size is determined by a
  record component clause are not considered in determining  the  value  of  S'
  SIZE.

# For the predefined type BOOLEAN, BOOLEAN'SIZE is one.
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  An  implementation  shall  describe, in Appendix F, how the value of 'SIZE is
  determined for objects, types, and subtypes.

[...under !discussion ...]

  In effect, the recommendation requires that 'SIZE for a subtype  (other  than
  an   unconstrained   array   subtype   or   an   unconstrained  subtype  with
  discriminants) yield a value that is the smallest amount of  space  allocated
  for  an  object  of  that subtype in a packed array or a packed record.  This
  requirement is consistent with the role of the SIZE attribute when specifying
  the  effect of pragma PACK on arrays and records (see AI-00554 and AI-00555).
# Since  it  is  intended  that  pragma  PACK  for  boolean  arrays  produce  a
# representation  with  no gaps between components (see AI-00555), BOOLEAN'SIZE
# is specified to be one.  Similarly, since  pragma  PACK  is  applied  to  the
# predefined type STRING, CHARACTER'SIZE must at least equal the number of bits
# allocated for a component of an object having type STRING.  If a component of
# type  CHARACTER  in  a  packed  record can be allocated only seven bits, then
# CHARACTER'SIZE would equal seven even if eight bits are used  for  components
# in  objects  of  type  STRING  (see  AI-00555).  No size is specified for the
# CHARACTER type  so  an  implementation  is  allowed  to  decide  how  closely
# components of type CHARACTER are packed in STRINGs.

[...]
===============================================================================

             reply	other threads:[~1991-11-14 16:45 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1991-11-14 16:45 Danford Lehman [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 16:00 Alex Blakemore
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-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