comp.lang.ada
 help / color / mirror / Atom feed
From: agate!spool.mu.edu!hri.com!noc.near.net!inmet!spock!stt@ucbvax.Berkeley.E DU  (Tucker Taft)
Subject: Re: What's the difference between...
Date: 13 Feb 93 19:18:10 GMT	[thread overview]
Message-ID: <1993Feb13.191810.4452@inmet.camb.inmet.com> (raw)

In article <64238@mimsy.umd.edu> alex@cs.umd.edu (Alex Blakemore) writes:

  [good stuff deleted]

> . . .
>  the compiler must use the same representation for all objects of
>  a type (irregardless of any subtypes) in this case, a placement
>  must take as many bits as any other integer, so the compiler
>  will likely use 4 bytes (say) and not 1 byte for each placement object.

This is not true.  In the absence of a size clause,
objects of a given subtype may be of any
size sufficient to hold every possible value of the subtype.
Actually, objects can be even smaller (in fact, non-existent)
if an optimizer knows all of the uses of the object, and knows
the actual range of values ever stored into the object.

It is true that some compilers follow the rule you state,
but others do not (and still validate, for what that's worth ;-).
With this latter group of compilers, objects of the subtype
could also be just one byte.  Remember that all numeric types
use pass by copy for parameter passing, so the actual representation
of a numeric object need not be known outside its lexical scope,
and need not be the same as other objects of the same numeric type.

The important point (which you and others have already made) has
to do with static semantics, not representation.  Operands of distinct types
cannot be mistakenly combined using the predefined operators or
assignment.  Explicit type conversion is required (of course
that's a bit annoying for multiplication -- we never did get
around to putting full support for "units" into Ada).

By contrast, operands which differ only in subtype are freely
combinable with the predefined operators and assignment (subject
to run-time constraint checks on assignment).

>Alex Blakemore alex@cs.umd.edu   NeXT mail accepted

S. Tucker Taft    stt@inmet.com
Intermetrics, Inc.
Cambridge, MA  02138

             reply	other threads:[~1993-02-13 19:18 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1993-02-13 19:18 agate!spool.mu.edu!hri.com!noc.near.net!inmet!spock!stt [this message]
  -- strict thread matches above, loose matches on Subject: below --
1993-02-16 17:34 What's the difference between John Bollenbacher
1993-02-16 16:17 enterpoop.mit.edu!ira.uka.de!scsing.switch.ch!sicsun!disuns2!lglsun!kipfe
1993-02-16 15:03 Robert I. Eachus
1993-02-15 13:24 cis.ohio-state.edu!zaphod.mps.ohio-state.edu!darwin.sura.net!haven.umd.ed
1993-02-15  1:55 cis.ohio-state.edu!zaphod.mps.ohio-state.edu!sdd.hp.com!portal!cup.portal
1993-02-14 19:55 Adam Beneschan
1993-02-14  3:08 agate!spool.mu.edu!sdd.hp.com!portal!cup.portal.com!R_Tim_Coslet
1993-02-13  5:30 Alex Blakemore
1993-02-12 23:57 Mark A Biggar
1993-02-12 23:51 kronos.arc.nasa.gov!butch!LMSC5.IS.LMSC.LOCKHEED.COM!LJ10891
1993-02-12 22:58 Robert I. Eachus
1993-02-12 18:52 Kenneth Anderson
replies disabled

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