comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@merv.cs.nyu.edu (Robert Dewar)
Subject: Re: ifdef replacement for GNAT
Date: 1998/04/10
Date: 1998-04-10T00:00:00+00:00	[thread overview]
Message-ID: <dewar.892261504@merv> (raw)
In-Reply-To: 86g1jm2gcf.fsf@zappa


Dirk asks

<<How is an Ada project (GNAT) being kept portable among various Unices
and say, Win32? Assume there is something special to be done in all
environments. Without using a nonstandard tool like gnatprep that is.
>>

The Steelman requirements prohibited the inclusion of preprocessing in
the Ada language, which may surprise you. What may surprise you more is
that I and many others think this is a *good thing*.

We provide gnatprep for our users, but we do NOT use it ourselves in
the GNAT system.

The proper approach for achieving target dependence is to follow two steps

  (a) encapsulte the target dependence down to the minimum level

  (b) Provide separate target dependent units for these remaining functions

This has worked well in the GNAT project. We do use some conditional
compilation in the small parts of the runtime written in C (probably 
conditions are overused here ...)

Indeed, the use of conditional compilation has many disadvantages:

1. It tends to run amok. People throw in #ifdef's without a moment's thought
   about how to make the code more common, and avoid the need for target
   dependent conditionalization.

2. Since deleted code is not syntax or semantic checked, you don't even know
   that your code will compile correctly for different combinations of checks.

By avoiding the inclusion of preprocessing facilities in the language, you
discourage their use. This discouragement is definitely a good thing.

Yes, people used to C find this surprising, but I have worked on several
large Ada systems that managed just fine in dealing with target dependencies
without resorting to conditional compilation.

Going back to GNAT, the front end is almost entirely target independent.

The backend is much more target independent than you might suppose. The
great majority of target dependence is encapsulated in the configuration
file, there is one such file for each target.

The runtime is mostly target dependent, with the exception of five files
that provide the low level tasking interface. These files have multiple
versions for different targets.





  reply	other threads:[~1998-04-10  0:00 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <352287EE.1CFB@tolstoy.mdc.com>
1998-04-08  0:00 ` ifdef replacement for GNAT John T Vegezzi 312C M 237110
1998-04-09  0:00   ` Robert Dewar
1998-04-10  0:00     ` Dirk Zoller
1998-04-10  0:00       ` Robert Dewar [this message]
1998-04-11  0:00         ` nabbasi
1998-04-11  0:00           ` Larry Kilgallen
1998-04-13  0:00           ` Richard Kenner
1998-04-11  0:00         ` raw
1998-04-11  0:00         ` Larry Kilgallen
1998-04-13  0:00         ` Michael F Brenner
1998-04-13  0:00           ` Larry Kilgallen
1998-04-15  0:00             ` Ada Programming Environment [was ifdef replacement for GNAT] Nick Roberts
1998-04-14  0:00         ` ifdef replacement for GNAT Jean-Pierre Rosen
1998-04-11  0:00       ` Geert Bosch
1998-04-12  0:00         ` Haug Buerger
1998-04-13  0:00           ` Aaro Koskinen
replies disabled

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