comp.lang.ada
 help / color / mirror / Atom feed
From: psinntp!ocsystems!kdh@uunet.uu.net  (Kevin D. Heatwole - OC Systems Inc.)
Subject: obj'size for constants
Date: 7 Sep 93 18:13:30 GMT	[thread overview]
Message-ID: <1993Sep7.181330.3952@ocsystems.com> (raw)

Any of you Ada "language lawyers" out there have an opinion on this one:

  Consider:

       one : constant integer := 1;

and integer'size = 32.  What are legitimate values that an implementation
may return for one'size?

I have read AI-00536 and it seems fairly clear that "if X is an object of
subtype S, then X'Size >= S'Size" so one'size should equal 32 (at least).
But, the LRM states that p'size yields the number of bits allocated to hold
the object.  In our implementation, scalar constants are replicated at use 
and rarely have any bits allocated to them at runtime (in this case, one
would most likely be represented in the hardware instruction (probably as
part of the op-code), rather than allocated in data memory).

In reading AI-00536, it doesn't seem that the authors considered this case
(rather they were mainly concerned with "pad" bits).

The reason I ask this question is that we are maintaining an Ada compiler
which returns the actual number of bits reserved for the object in memory
(e.g., one'size = 0), but a pesky user has filed a defect indicating that
the result should be the same as type'size for constants (e.g., one'size = 32).
We must fix all reported defects (if legitimate), but I would rather leave
the current behaviour as it is.

Thanks for any replies,

Kevin D. Heatwole
OC Systems, Inc.
kdh@ocsystems.com

             reply	other threads:[~1993-09-07 18:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1993-09-07 18:13 Kevin D. Heatwole - OC Systems Inc. [this message]
  -- strict thread matches above, loose matches on Subject: below --
1993-09-07 21:22 obj'size for constants Robert Dewar
1993-09-08 14:27 John Goodenough
replies disabled

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