comp.lang.ada
 help / color / mirror / Atom feed
From: Laurent Pautet <pautet@inf.enst.fr>
Subject: Re: Conditional Code in Ada 95?
Date: 1998/08/28
Date: 1998-08-28T00:00:00+00:00	[thread overview]
Message-ID: <rca7lztnvfu.fsf@scapin.enst.fr> (raw)
In-Reply-To: 6s0fcl$3gj$1@platane.wanadoo.fr

"Jean-Pierre Rosen" <rosen.adalog@wanadoo.fr> writes:
> 
> However, there is something that's damn close to it:
> 
> with Hardware_Specific_1;
> package Hardware_Specific renames Hardware_Specific_1;
> 
> and then use package Hardware_Specific all over the place. If you change
> hardware, there is one line to change in the whole program.

Well, that's not so easy. It could be quite difficult to maintain. It
could be very error-prone as well.

For a package with constant declarations, I think it is better to
generate it automatically (during configuration).

Concerning the code, for a package (which is a logical unit you don't
want to reorganize), you have to split it into a platform independent
part and N platform dependent parts. It's even worth when platforms
are really different (Windows vs Unix). A piece of code could be
identical on any Unix platform (so why would you duplicate it?) but
different on Windows. If you do this for several units, then it's a
lot of work and a lot of errors.

The trick you mentioned is used in the GNAT run-time. Robert can tell
us whether it is easy to maintain or not. I should admit that it won't
be easier to maintain it using conditional code. But if you look
closely to some low level parts of GNAT, there are written in C with
conditional code (OS_Lib for instance). So, both mechanisms are used.

I think there is no general solution and you should be allowed to use
package renaming, automatic code generation or conditional
code. Incidentally, I guess each compilor vendor has its own tool to
provide conditional code but as it is not standardized, it is not
portable.

-- 
-- Laurent




  reply	other threads:[~1998-08-28  0:00 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-08-21  0:00 Conditional Code in Ada 95? Rex Reges
1998-08-21  0:00 ` Gene Ouye
1998-08-24  0:00   ` Mark A Biggar
1998-08-27  0:00     ` Samuel T. Harris
1998-08-27  0:00       ` David C. Hoos, Sr.
1998-08-22  0:00 ` dewarr
1998-08-22  0:00 ` Gautier.DeMontmollin
1998-08-23  0:00   ` dewar
1998-08-24  0:00     ` Gautier.DeMontmollin
1998-08-24  0:00   ` Michael F Brenner
1998-08-25  0:00     ` Jean-Pierre Rosen
1998-08-28  0:00       ` Laurent Pautet [this message]
1998-08-25  0:00     ` dewarr
1998-08-25  0:00       ` Richard D Riehle
1998-08-26  0:00         ` dennison
1998-08-26  0:00           ` Richard D Riehle
1998-08-27  0:00             ` dennison
1998-08-26  0:00       ` Michael F Brenner
replies disabled

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