From: stt@spock.camb.inmet.com (Tucker Taft)
Subject: Re: Naive question about system dependencies
Date: Fri, 16 Sep 1994 17:28:49 GMT
Date: 1994-09-16T17:28:49+00:00 [thread overview]
Message-ID: <Cw8GK2.M9y@inmet.camb.inmet.com> (raw)
In-Reply-To: hholm.110.2E77EA6F@clark.net
In article <hholm.110.2E77EA6F@clark.net>, Howard Holm <hholm@clark.net> wrote:
>I have some experience using Ada in a classroom setting, but unfortunately
>little experience using it in any real-world settings. I was considering how
>I would go about writing a program that was intended to be used in several
>different operating system environments (e.g. OS/2 and UNIX). If I were using
>C, I would either use compiler generated macros, if they existed, or create
>some macros in the makefile that could be used to determine which system was
>the target (i.e. #ifdef OS2). The most likely equivalent seemed to me to be
>the System_Name constant in the System package. However, when I checked, the
>Gnat compiler simply uses "GNAT" for that definition. So, my question is how
>do you go about accounting for differences in GUI's and the like? Do you have
>a build directory that you copy implementation specific low-level packages
>into and out of for each build, or do you define a search path and have a
>collection of implementation specific directories and an independent
>directory? Or, did I overlook some other language featue to address this
>question?
Some people use the C preprocessor (or equivalent) with Ada source
code. However, in our environment we have found it is more
maintainable to avoid using the preprocessor approach, and define
interfaces to isolate target/host independent code from target/host
dependent code, and then have separate bodies to implement
the interface for each target/host.
Although this might seem like more work, in the long run
it vastly simplifies the process of moving to a new target
or host, and keeps the code much more readable than when
ifdef's and associated target dependences are littered around the code.
>Howard Holm
>hholm@clark.net
-Tucker Taft stt@inmet.com
next prev parent reply other threads:[~1994-09-16 17:28 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
1994-09-15 6:32 Naive question about system dependencies Howard Holm
1994-09-16 17:28 ` Tucker Taft [this message]
1994-09-17 16:23 ` Mats Weber
1994-09-19 12:05 ` Ted Dennison
1994-09-19 14:39 ` Cyrille Comar
1994-09-19 15:00 ` Norman H. Cohen
1994-09-20 9:02 ` Stephen J Bevan
[not found] ` <85B716C4188@annwfn.com>
1994-09-22 13:33 ` David Kehs
1994-09-22 14:15 ` Robert Dewar
1994-09-23 4:34 ` R. William Beckwith
1994-09-22 14:54 ` Norman H. Cohen
-- strict thread matches above, loose matches on Subject: below --
1994-09-19 14:48 Bob Crispen
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox