comp.lang.ada
 help / color / mirror / Atom feed
From: Daryl Siddon <Daryl.Siddon@cpmx.saic.com>
Subject: Re: HELP:Declaration in ADA?!!
Date: 1996/04/18
Date: 1996-04-18T00:00:00+00:00	[thread overview]
Message-ID: <317708AE.48E3@cpmx.saic.com> (raw)
In-Reply-To: 4ulok5fn1m.fsf@zippy.frc.ri.cmu.edu

Martin C. Martin wrote:
> 
> > Tuyet-Tram DANG-NGOC <dangngoc@ens-info.uvsq.fr> wrote:
> >
> > >Hi there,
> >
> > >I have a stupid question to ask.
> > >DOES SOMEONE KNOW HOW TO DECLARE LONG_INTEGER IN ADA?
> > >All the books I've read here does not answer this metaphysical question, they
> > >just take it as if everyone should know how to declare it. In a wonderful
> > >book, I've seen how to declare LONG_REAL by typing:
> > >   type LONG_REAL is DIGIT 14;
> > >But how to do it for LONG_INTEGER?
> > >Can someone answers me pleeeeaaaase, i've a big and horrible project to finish
> > >for very soon.
> 
> Long_Integer may already be defined in your compiler; the ARM says
> it's an optional type, but I think most compilers define it (at least,
> if there are assembly instructions which would manipulate such an
> integer directly).
> 
> If not, you can define it this way:
> 
> type Long_Integer is range -2_147_483_647 .. 2_147_483_647
> 
> Mind you, I think this will only work if there already is a 32 bit
> integer type in your compiler, and if so it's probably already called
> Long_Integer.
> 
> Martin.

The approach we used on a recent large scale production software
development effort was to RESTRICT the use of the Standard types in 
application code, by declaring a uniquely named package "Project_Types"
which had all low-level (compiler implementation defined) types. 
This project must ensure that future maintenance (20 years worth) will 
be relatively easy to adapt to new compliers. This "Project_Types"
package localizes the changes needed when using a different compiler. 
All application types are based upon the "Project_Types" package.

Typical types in "Project_Types" may be:
      type unsigned_integer16 is ...
      type unsigned_integer32 is ...
      type signed_integer16   is ...
      etc. 

Developers make specific decisions about the types their application
code needs based upon the range of values, as opposed to "implementation
defined" ranges (e.g. Standard.Integer).

Disadvantage: The types in this package must be pinned-down very early
              in the project lifecycle, as any change/addition will
              necessitate a recompile for all client units.
              NOTE: As an entry criteria for Code Reviews, no Standard
                    types are allowed; only those from "Project_Types".
                    Prior to code being submitted to an "engineering
                    build," scripts are run to scan for misuse.

Advantage   : It localizes the "compiler implementation defined" types,
              rather than throughout application code.

Hope this helps.

Daryl Siddon (Opinions only mine)




  parent reply	other threads:[~1996-04-18  0:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-03-25  0:00 HELP:Declaration in ADA?!! Tuyet-Tram DANG-NGOC
1996-03-25  0:00 ` Robert Dewar
1996-03-25  0:00 ` Laurent Guerby
1996-03-28  0:00 ` Ken Devlin
1996-04-08  0:00 ` Ken Devlin
1996-04-09  0:00   ` Walter B. Hollman Sr.
1996-04-09  0:00   ` Martin C. Martin
1996-04-09  0:00     ` Keith Thompson
1996-04-18  0:00     ` Daryl Siddon [this message]
1996-04-22  0:00       ` John English
1996-04-24  0:00         ` Robert Dewar
  -- strict thread matches above, loose matches on Subject: below --
1996-03-25  0:00 tmoran
1996-03-28  0:00 Scott B. Crawford 0131-314-8253
replies disabled

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