comp.lang.ada
 help / color / mirror / Atom feed
From: Ted Dennison <dennison@escmail.orl.mmc.com>
Subject: Re: some questions re. Ada/GNAT from a C++/GCC user
Date: 1996/03/28
Date: 1996-03-28T00:00:00+00:00	[thread overview]
Message-ID: <315AC5E7.3A77@escmail.orl.mmc.com> (raw)
In-Reply-To: wnewmanDoxrCp.DKv@netcom.com

Bill Newman wrote:
> 
> Does GNAT completely implement generics as defined in the standard?
> (I ask because I have heard that no compiler, G++ otherwise, has yet
> implemented C++ templates completely, and the G++ implementation
> caused me lots of hassles before 2.7.x, and still causes some hassles
> now.)

The environment in the Ada community is such that the community won't
accept an Ada compiler that doesn't match the standard, except in some
extreme circumstances (such as embedded programming). If it is in the
Ada standard, then you can pretty much count on an Ada compiler 
implementing it as specified (barring bugs of course).

> When I make two different instantiations of a generic package with the
> same arguments, I understand the compiler treats them formally as two
> different packages, which is OK with me.  However, I'd appreciate
> knowing the compiler wouldn't actually output two redundant copies of
> the corresponding (identical?) machine code, but instead share the
> code.  I saw somewhere that the compiler is given considerable freedom
> to share one instantiation between several arguments if it thinks it's
> appropriate, which is also OK with me.  However, I haven't seen any
> guarantee that the compiler won't output redundant copies for
> instantiations with identical arguments.  Is there such a guarantee?

If you want a guarantee, put the code you want shared in a non-generic
package or procedure, and call it from your generic package or
procedure.

> Why doesn't Ada 95 allow declarations to be interspersed with ordinary
> statements as C++ does?  (Or does it?  _Ada as a Second Language_ is a
> big book!)  It seems to me that the C++ approach is a small but
> definite win.  Does it interact very badly somehow with all those
> guarantees on elaboration order?

Not really. If you want to declare variables later in the code just 
use a declare block:
   declare
      Var1 : My_Type;
      ...
   begin
      Var1 := My_Value;
      ...
   end;

This has the added benefit of limiting the scope of Var1 to the
begin..end
block of code.

(paraphrase: where are macros?)

I hate macros!!! Anyone who has has ever tried to compile emacs from
sources should agree with me. Anyone who has ever tried to figure out
"portable" C code should agree with me. Practically all of the
functionality of macros can be implemented in Ada in other ways. Ways
that are much easier to understand and maintain.

And lastly, if you really like them, implement your own pre-processor.
You wouldn't be the first.

> Finally, I found it intriguing when someone (somewhere in the endless
> C++ vs. Ada thread) described a program which used exceptions to
> convert runtime errors to `graceful degradation' so successfully that
> the program (for fire control?!) continued operating more-or-less

If you are mostly doing command processing (and no human lives are at
stake), this makes perfect sense. Just because there is some kind of 
problem (or exceptional condition) with one command doesn't mean the 
others can't work perfectly. In this case, why core dump? Just log the 
problem and continue.


-- 
T.E.D.          
                |  Work - mailto:dennison@escmail.orl.mmc.com  |
                |  Home - mailto:dennison@iag.net              |
                |  URL  - http://www.iag.net/~dennison         |




  parent reply	other threads:[~1996-03-28  0:00 UTC|newest]

Thread overview: 80+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-03-27  0:00 some questions re. Ada/GNAT from a C++/GCC user Bill Newman
1996-03-27  0:00 ` Robert Dewar
1996-03-28  0:00   ` Norman H. Cohen
1996-03-28  0:00   ` Brian Rogoff
1996-03-29  0:00     ` John G. Volan
1996-03-30  0:00       ` Robert A Duff
1996-03-31  0:00         ` Robert Dewar
1996-04-01  0:00           ` Norman H. Cohen
1996-03-31  0:00         ` John G. Volan
1996-03-31  0:00           ` Mike Young
1996-04-02  0:00             ` Glenn H. Porter
1996-04-02  0:00               ` Robert Dewar
1996-04-02  0:00               ` Jonas Nygren
1996-04-03  0:00               ` Geert Bosch
1996-04-03  0:00                 ` Robert Dewar
1996-04-01  0:00           ` Robert A Duff
1996-04-03  0:00             ` Scott Leschke
1996-04-04  0:00               ` AdaWorks
1996-04-01  0:00           ` Bruce.Conroy
1996-03-30  0:00       ` Mike Young
1996-03-30  0:00         ` Ted Dennison
1996-03-31  0:00           ` Mike Young
1996-04-01  0:00       ` Norman H. Cohen
1996-04-01  0:00         ` Robert A Duff
1996-04-01  0:00           ` Mike Young
1996-04-02  0:00             ` Norman H. Cohen
1996-04-02  0:00             ` Robert A Duff
1996-04-01  0:00         ` Mike Young
1996-04-02  0:00           ` Robert Dewar
1996-04-02  0:00           ` David Shochat
1996-04-02  0:00             ` Mike Young
1996-04-02  0:00           ` Norman H. Cohen
1996-03-28  0:00 ` Ted Dennison [this message]
1996-03-29  0:00   ` Adam Beneschan
1996-03-28  0:00 ` Scott Leschke
1996-03-29  0:00   ` Robert I. Eachus
1996-03-29  0:00   ` Robert A Duff
1996-03-30  0:00     ` Richard Pitre
1996-03-30  0:00       ` Robert A Duff
1996-03-31  0:00         ` AdaWorks
1996-04-01  0:00           ` Robert A Duff
1996-04-01  0:00             ` AdaWorks
1996-04-01  0:00               ` Mike Young
1996-04-02  0:00                 ` AdaWorks
1996-04-02  0:00                 ` Robert Dewar
1996-04-01  0:00             ` Ken Garlington
1996-04-01  0:00               ` Robert A Duff
1996-04-02  0:00                 ` Ken Garlington
1996-04-02  0:00                   ` Robert A Duff
1996-04-02  0:00                     ` Ken Garlington
1996-04-02  0:00                       ` Robert A Duff
1996-04-03  0:00                         ` Ken Garlington
1996-04-09  0:00                           ` Matt Kennel
1996-04-03  0:00                         ` David Emery
1996-04-02  0:00                 ` Tucker Taft
1996-04-02  0:00                   ` Felaco
1996-04-02  0:00                     ` Robert Dewar
1996-04-03  0:00                     ` Mark A Biggar
1996-04-01  0:00             ` Norman H. Cohen
1996-04-01  0:00         ` Richard A. O'Keefe
1996-04-01  0:00           ` Robert A Duff
1996-04-01  0:00         ` Robert Dewar
1996-04-02  0:00       ` Robert I. Eachus
1996-03-29  0:00   ` Bill Newman
1996-03-29  0:00 ` Robert A Duff
1996-03-29  0:00   ` Brian Rogoff
1996-04-01  0:00     ` Mark A Biggar
1996-04-01  0:00       ` Robert A Duff
1996-03-30  0:00   ` Iterators (was Re: some questions re. Ada/GNAT from a C++/GCC user) Robert I. Eachus
1996-03-31  0:00     ` Mike Young
1996-03-31  0:00       ` Fergus Henderson
     [not found]   ` <4jlj79$h1k@Nntp1.mcs.net>
1996-04-01  0:00     ` some questions re. Ada/GNAT from a C++/GCC user Robert A Duff
1996-04-02  0:00       ` Kevin Cline
1996-04-02  0:00         ` Robert A Duff
1996-04-01  0:00   ` Iterators (was Re: some questions re. Ada/GNAT from a C++/GCC user) Robert I. Eachus
1996-04-04  0:00   ` some questions re. Ada/GNAT from a C++/GCC user Jon S Anthony
1996-03-30  0:00 ` Simon Wright
1996-04-01  0:00 ` Laurent Guerby
1996-04-01  0:00   ` Robert A Duff
  -- strict thread matches above, loose matches on Subject: below --
1996-03-28  0:00 Simon Johnston
replies disabled

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