comp.lang.ada
 help / color / mirror / Atom feed
From: johnro@microsoft.UUCP (John Rogers)
Subject: Re: Questions on Ada...
Date: 5 Jul 89 23:42:33 GMT	[thread overview]
Message-ID: <6233@microsoft.UUCP> (raw)
In-Reply-To: 3034@wpi.wpi.edu

Hi!  There is another, more standard, way of doing conditional compilation
in Ada.  The original article had something like:

#ifdef SOMETHING
    random_C_code;
#endif

In Ada, it's possible to have groups of statements that are never
executed.  For instance:

   procedure Example is
     Something : constant Boolean := True;    -- change and recompile...
   begin
     if (Something) then
       random_Ada_Code;
     end if;
   end Example;

If "Something" is set to False in some other environment, then the
statements ("random_Ada_Code") will never be executed.  The ANSI/MIL-STD
for Ada allows this, and allows compilers to completely optimize out the
code.  This acts as a sort of conditional compilation.

Unfortunately, this isn't a complete solution to the need for
conditional compilation.  There's no way to do this for data declarations,
or "with" clauses, or various other things - just executable statements.

Hope this helps...

      parent reply	other threads:[~1989-07-05 23:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1989-06-29  3:33 Questions on Ada Krishan M Nainani
1989-07-03 13:51 ` arny.b.engelson
1989-07-06 19:02   ` Vladimir G. Ivanovic
1989-07-11 19:41     ` arny.b.engelson
1989-07-05 23:42 ` John Rogers [this message]
replies disabled

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