comp.lang.ada
 help / color / mirror / Atom feed
From: "Samuel T. Harris" <s_harris@hso.link.com>
Subject: Re: Ada enumerations
Date: 1997/12/12
Date: 1997-12-12T00:00:00+00:00	[thread overview]
Message-ID: <34917961.B3D25079@hso.link.com> (raw)
In-Reply-To: 34901D71.FD118790@elca-matrix.ch


Mats Weber wrote:
> 
> Robert Dewar wrote:
> 
> > My own feeling is that unchecked conversion is adequate. In practice it
> > should work fine in any reasonable compiler to just do a conversion to the
> > largest unsigned type, even if the sizes do not match (I can't imah=gine a
> > compiler not doing the "right" thing there).
> 
> Are you sure this will work if the machine is big endian ?
> 
> Isn't Unchecked_Conversion approximately like doing
> 
>    X : Enum;
>    I : Integer;
> 
>    for I'Address use X'Address;

Approximately yes, but the small difference can kill you!
Whereas unchecked_conversion can be expected to do the "right"
thing when the sizes don't exactly match, the above can
only be expected to cause problems if the programmer doesn't
make sure the sizes are right.

Remember, Stanley's problem involves supporting a generic
facility on any enumeration type. Sizes will vary. While
Robert's suggestiong, while compiler specific, might apply
to Stanley's situation, the above use of and address
rep clauses will certainly not work for Stanley.

-- 
Samuel T. Harris, Senior Engineer
Hughes Training, Inc. - Houston Operations
2224 Bay Area Blvd. Houston, TX 77058-2099
"If you can make it, We can fake it!"




  parent reply	other threads:[~1997-12-12  0:00 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-12-10  0:00 Ada enumerations Stanley R. Allen
1997-12-10  0:00 ` John M. Mills
1997-12-10  0:00 ` Robert Dewar
1997-12-11  0:00   ` Mats Weber
1997-12-11  0:00     ` Robert Dewar
1997-12-12  0:00       ` Mats Weber
1997-12-12  0:00         ` Robert Dewar
1997-12-12  0:00     ` Samuel T. Harris [this message]
1997-12-11  0:00   ` Stanley R. Allen
1997-12-12  0:00     ` Robert Dewar
  -- strict thread matches above, loose matches on Subject: below --
1997-12-03  0:00 Ada Enumerations Jeffrey Harris
1997-12-03  0:00 ` James S. Rogers
1997-12-03  0:00   ` Robert Dewar
1997-12-03  0:00     ` Stanley R. Allen
1997-12-04  0:00       ` Robert Dewar
1997-12-04  0:00         ` Stanley R. Allen
1997-12-18  0:00           ` Wes Groleau
1997-12-04  0:00       ` Matthew Heaney
1997-12-04  0:00         ` Stanley R. Allen
1997-12-07  0:00           ` Keith Thompson
1997-12-07  0:00             ` Robert Dewar
1997-12-08  0:00               ` Keith Thompson
1997-12-07  0:00                 ` Matthew Heaney
1997-12-11  0:00                   ` John G. Volan
1997-12-07  0:00             ` Matthew Heaney
1997-12-04  0:00 ` Stephen Leake
1997-12-04  0:00   ` Matthew Heaney
1997-12-04  0:00     ` Robert Dewar
1997-12-06  0:00       ` Jean-Pierre Rosen
replies disabled

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