comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <Stephen.Leake@gsfc.nasa.gov>
Subject: Re: Ada 83 - avoiding unchecked conversions.
Date: 1996/12/13
Date: 1996-12-13T00:00:00+00:00	[thread overview]
Message-ID: <32B17F46.123B@gsfc.nasa.gov> (raw)
In-Reply-To: 32B062D3.7E9A@ccgate.hac.com


Chris Brand wrote:
> 
> Matthew Heaney wrote:
> >
> [cut]
> > But knowing the representation of the data is only important at the
> > hardware level, ie "the interface boundary."  Internal to the software
> > there's a lot going on that doesn't depend on representation of the data,
> > so we want to practice some information hiding by letting the compiler
> > choose the representation.
> >
> [cut]
> >
> > This confusion is also the reason why shops often say "Thou shalt not use
> > predefined types, because it's not portable."  This too is another silly
> > rule.
> >
> > It would be perfectly valid for such a rule at the interface layer, because
> > I have to know the representation of my types.  But internal to the
> > software system, I don't care, and using predefined types is just another
> > form of information hiding.
> >
> [examples cut]
> 
> I worked on a project where the rule was not to use predefined types.
> We had a package defining the "base types" to use, with all their
> representation clauses and everything and we had to base our types on
> these.
> The main type was an "Integer_16".
> 
> This was great while we were using a 286 target. It was only when we
> ported
> it to a 486 target (where 16-bit values need more work than 32-bit ones)
> that we noticed the disadvantage of such a rule. Left to itself, the
> compiler would have chosen a 16-bit value for most things on the 286 and
> a 32-bit value on the 486.
> 
> Of course, if you take these things away, people have to think about
> "what is a sensible upper bound for this type ?" :-)

Perhaps there should have been a type "Fast_Integer", with the
understanding that it was at least 16 bits (this is of course just
Standard.Integer). Then programmers can use Fast_Integer when they don't
really care about the size.


> 
> --
> Chris
> Stating my own opinions, not those of my company.

-- 
- Stephe




  reply	other threads:[~1996-12-13  0:00 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <md5:8B831999BCF200C6E70994BDF6CC529F>
1996-12-11  0:00 ` Ada 83 - avoiding unchecked conversions Chris Sparks (Mr. Ada)
1996-12-11  0:00   ` Dewi Daniels
1996-12-12  0:00     ` Richard Kenner
1996-12-17  0:00       ` Eric Miller
1996-12-18  0:00         ` Robert Dewar
1996-12-18  0:00           ` Robert A Duff
1996-12-19  0:00           ` Keith Thompson
1996-12-26  0:00             ` Robert Dewar
1996-12-11  0:00   ` Matthew Heaney
1996-12-12  0:00     ` Chris Brand
1996-12-13  0:00       ` Stephen Leake [this message]
1996-12-14  0:00         ` Robert A Duff
1996-12-14  0:00     ` BGaffney42
1996-12-19  0:00   ` Robert I. Eachus
1996-11-27  0:00 Ensco Vendor
1996-11-27  0:00 ` Robert I. Eachus
1996-11-29  0:00 ` Robert Dewar
1996-12-01  0:00   ` Darel Cullen
1996-11-30  0:00     ` Robert Dewar
1996-12-11  0:00     ` Richard Riehle
1996-12-02  0:00 ` Ted Dennison
1996-12-10  0:00   ` Matthew Heaney
replies disabled

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