comp.lang.ada
 help / color / mirror / Atom feed
From: tmoran@acm.org
Subject: Re: data types & efficiency
Date: Fri, 05 Mar 2004 20:53:07 GMT
Date: 2004-03-05T20:53:07+00:00	[thread overview]
Message-ID: <TM52c.49508$ko6.395191@attbi_s02> (raw)
In-Reply-To: c2a7qq$625$1@e3k.asi.ansaldo.it

> to enforce the indepence from compiler in terms of their internal
> representation.
> So I will define for example:
>
> type UNSIGNED_INT_32_TYPE is range 0..(2**32)-1:
> for  UNSIGNED_INT_32_TYPE'SIZE use 32;
>
> to be used instead of the predefined Integer type.
  Usually people want their program to *run* the same regardless of
which compiler compiled it.  You seem to want its data area to be
the same size, the maximum size any compiler might use.  Why is that?
  Thus a program to play cards might define
    type Suite is (Clubs, Diamonds, Hearts, Spades);
A memory optimizing compiler on a suitably addressable architecture
might use 2 bits.  Another compiler on another machine might use 32.
Why do you require that they both use 32 bits to represent the four
possible values?
  For Integer, don't use the predefined type and assume it's, say, 32
bits.  Instead declare your own
  type home_thermostat_F_settings is range 55.. 90;
  type person_numbers is range 0 .. 50_000_000_000;
and let different compilers on different architectures use different
storage arrangements - your data values will never fall outside those
ranges so any extra bits are immaterial to the correct running of
your program.



  reply	other threads:[~2004-03-05 20:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-05  8:02 data types & efficiency Davide
2004-03-05  9:23 ` Vinzent 'Gadget' Hoefler
2004-03-05  9:57   ` Davide
2004-03-05 12:00     ` Vinzent 'Gadget' Hoefler
2004-03-05 15:54       ` Davide
2004-03-05 20:53         ` tmoran [this message]
2004-03-08  9:28           ` Davide
2004-03-08  8:58         ` Vinzent 'Gadget' Hoefler
2004-03-08 10:53           ` Davide
2004-03-08 15:27           ` Robert I. Eachus
2004-03-05 10:22 ` 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