From: "Marin D. Condic" <mcondic-nospam@acm.com>
Subject: Re: conditional compilation
Date: 2000/07/31
Date: 2000-07-31T13:25:36+00:00 [thread overview]
Message-ID: <39857E5F.33C40014@acm.com> (raw)
In-Reply-To: 87d7jvp3qq.fsf@chiark.greenend.org.uk
Matthew Woodcraft wrote:
>
> I noticed the following statement in the Steelman requirements:
>
> "6C. Conditional Control. There shall be conditional control structures
> that permit selection among alternative control paths.
> ...
> Only the selected branch shall be compiled when the discriminating
> condition is a translation time expression."
>
> Am I right in thinking that the second sentence above isn't true of
> Ada-as-we-know-it (for example, if a non-selected branch has a
> compile-time error)?
>
I know from experience with a few different embedded compilers that it
was a common optimization to remove dead code. A construct such as:
declare
Debug : constant Boolean := False ;
begin
if (Debug) then
Do_Some_Stuff ;
else
Do_Some_Other_Stuff ;
end if ;
end ;
would result in the call to Do_Some_Stuff being removed from the object
code. It was a reasonably effective method of getting conditional
compilation. However, I don't recall that the unreachable code could
ever be syntactically incorrect - or why you would want it to be.
Of course the weakness of this is that you can't pull this trick in a
declarative part. It would be nice to have a mechanism for controlling
that sort of thing as well. (Yes, GNAT has pragma Debug - it's just not
part of the standard - yet.)
Now I'm not sure that a true conditional compilation feature based on
lexical exclusion is really such a good idea. I've been doing a lot of
C++ work lately using Visual C++/MFC and it never ceases to amaze me
that people actually *like* this kind of thing. I'm constantly tracking
down problems related to #ifdef and #include causing multiple instances
of things getting brought in - or not. And of course, the compiler
doesn't care because its C. Would Ada really want to get caught up in
that web?
BTW: Visual C++ has a *really* nice debugger. But then again, it needs
it. :-) It would be nice to see an environment this powerful for Ada.
MDC
--
======================================================================
Marin David Condic - Quadrus Corporation - http://www.quadruscorp.com/
Send Replies To: m c o n d i c @ q u a d r u s c o r p . c o m
Visit my web site at: http://www.mcondic.com/
"Nothing in the world is more dangerous than sincere ignorance and
conscientious stupidity."
-- Martin Luther King, Jr
======================================================================
next prev parent reply other threads:[~2000-07-31 0:00 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-07-31 0:00 conditional compilation Matthew Woodcraft
2000-07-31 0:00 ` Marin D. Condic [this message]
2000-07-31 0:00 ` Ira D. Baxter
2000-08-01 0:00 ` Simon Brady
2000-07-31 0:00 ` Marin D. Condic
2000-08-01 0:00 ` Ted Dennison
2000-08-01 0:00 ` Robert A Duff
2000-08-01 0:00 ` Laurent Guerby
2000-08-02 0:00 ` Simon Brady
2000-08-02 0:00 ` Simon Brady
2000-08-01 0:00 ` William J. Thomas
2000-08-02 0:00 ` Robert A Duff
2000-08-02 0:00 ` Georg Bauhaus
2000-08-03 0:00 ` Robert A Duff
2000-08-02 0:00 ` Brian Rogoff
2000-08-03 0:00 ` Robert A Duff
2000-08-03 0:00 ` Florian Weimer
2000-08-02 0:00 ` Georg Bauhaus
-- strict thread matches above, loose matches on Subject: below --
2000-09-19 0:00 Conditional Compilation Kenneth Kueny
2000-09-19 0:00 ` Richard Riehle
2000-09-19 0:00 ` David Starner
2000-09-19 0:00 ` E. Robert Tisdale
2000-09-19 0:00 ` David Starner
2000-09-20 0:52 ` Robert Dewar
2000-09-19 0:00 ` Larry Kilgallen
2000-09-19 0:00 ` Jeff Allen
2000-09-20 0:49 ` Robert Dewar
2000-09-19 0:00 ` Bobby D. Bryant
2000-09-24 0:00 ` Robert Dewar
2000-09-20 0:47 ` Robert Dewar
2000-10-09 0:00 ` John McCabe
2000-09-19 0:00 ` Jeffrey Carter
2000-09-19 0:00 ` Samuel T. Harris
2000-09-20 0:44 ` Robert Dewar
2000-09-19 0:00 ` Ted Dennison
2000-09-20 1:33 ` tmoran
[not found] ` <8qauu3$7ei$1@nnrp1.deja.com>
2000-09-24 0:00 ` Robert Dewar
2000-09-25 2:45 ` Ted Dennison
2000-09-25 0:00 ` peter
[not found] ` <39CA31F2.E160F0D8@res.raytheon.com>
2000-09-24 0:00 ` Robert Dewar
2001-01-02 13:27 ` Andrew Hately
2001-01-02 16:46 ` Robert Dewar
1989-12-12 0:08 conditional compilation Emery
1988-06-13 0:24 Conditional compilation Steinar Haug
1988-06-17 13:53 ` rds
1988-06-22 0:44 ` Jeff Bartlett
1988-06-23 13:01 ` Arny B. Engelson
1988-06-27 18:01 ` Dave Seward
1988-06-29 13:32 ` brucej
1988-06-17 14:48 ` rjs
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox