comp.lang.ada
 help / color / mirror / Atom feed
From: fraser@synopsys.com (Fraser Wilson)
Subject: Re: PRECOMPILATION
Date: 1999/02/10
Date: 1999-02-10T00:00:00+00:00	[thread overview]
Message-ID: <79sgbu$aod$1@remarQ.com> (raw)
In-Reply-To: 36C0B5D4.DEF83A66@averstar.com

I nearly cried when stt@averstar.com said:

>However, we have had good experience with making the
>unit of variation be the whole source file.  Typically
>you can define a small number of primitive types and constants
>which can isolate out the environment-specificity from all
>other source files.  Then you only need to select which
>version of this one source file you will use to switch from
>one environment to another.  Our experience is that this approach
>is dramatically more maintainable that spreading #ifdef's or
>equivalent out all over the code.

Indeed.  For various reasons, I maintain a small compiler that emits
assembler for either a 32 bit virtual processor that executes editor
extension commands, or an 8 bit 6502 (which means that I can finally
use Ada on my Commodore 64 -- actually, a C64 emulator, but close
enough).  To switch between targets, I put all the system dependent
stuff in subdirectories of the main source tree, and use compile
time flags to tell gnatmake to select the appropriate one.  Voila!
It's safe, and it's hard to create obscure bugs this way.

This works unbelievably better that mucking around with a preprocessor.
I remember those days when I used a bunch of #error directives to try
to find out why a particular file, the subject of a #include, wasn't
being read, and the culprit was usually some sort of #define coupled
with #ifdef stuff.  Pure evil.  Mind you, we were using Visual C++,
so we were kind of doomed from the start I think.

On a side note, who wants to target GNAT to MMIX?  There's some
interesting features on the chip that are impossible (or very dodgy)
to access from C, whereas Ada compilers can target them with ease.

cheers,
Fraser.
--
Fraser Wilson   |  700 East Middlefield Rd  |  Phone:  650 943 5270
Sr R&D Engineer |  Mountain View, CA 94043  |  Fax:    650 934 1227
Synopsys Inc    |  USA                      |  Email:  fraser@synopsys.com
           Ada, Linux, PowerPC: The Golden Triangle




  reply	other threads:[~1999-02-10  0:00 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-02-09  0:00 PRECOMPILATION =:-) Vincent
1999-02-09  0:00 ` PRECOMPILATION Tucker Taft
1999-02-10  0:00   ` Fraser Wilson [this message]
1999-02-18  0:00   ` PRECOMPILATION Samuel Mize
1999-02-18  0:00     ` PRECOMPILATION Rakesh Malhotra
1999-02-19  0:00       ` PRECOMPILATION Samuel Mize
1999-02-18  0:00     ` PRECOMPILATION robert_dewar
1999-02-28  0:00     ` PRECOMPILATION Robert A Duff
1999-02-09  0:00 ` PRECOMPILATION Marin David Condic
1999-02-09  0:00 ` PRECOMPILATION Tom Moran
1999-02-10  0:00   ` PRECOMPILATION Pascal MALAISE
1999-02-10  0:00     ` PRECOMPILATION Tom Moran
1999-02-09  0:00 ` PRECOMPILATION Larry Kilgallen
1999-02-09  0:00   ` PRECOMPILATION Pascal MALAISE
1999-02-09  0:00     ` PRECOMPILATION Tom Moran
1999-02-10  0:00       ` PRECOMPILATION Pascal MALAISE
1999-02-10  0:00         ` PRECOMPILATION Tom Moran
1999-02-11  0:00           ` PRECOMPILATION Pascal MALAISE
1999-02-12  0:00             ` PRECOMPILATION robert_dewar
1999-02-14  0:00               ` PRECOMPILATION Pascal MALAISE
1999-02-09  0:00     ` PRECOMPILATION Tom Moran
1999-02-10  0:00       ` PRECOMPILATION robert_dewar
1999-02-10  0:00       ` PRECOMPILATION Corey Ashford
1999-02-10  0:00       ` PRECOMPILATION dennison
1999-02-09  0:00     ` PRECOMPILATION Tucker Taft
replies disabled

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