comp.lang.ada
 help / color / mirror / Atom feed
From: bglbv@my-dejanews.com
Subject: Re: Fortran or Ada?
Date: 1998/09/23
Date: 1998-09-23T00:00:00+00:00	[thread overview]
Message-ID: <6uan3f$7qe$1@nnrp1.dejanews.com> (raw)
In-Reply-To: slrn70dv6k.2qp.gisle@krake.ii.uib.no

gisle@krake.ii.uib.no (Gisle S{lensminde) wrote:
[lots of good remarks, I'll only correct a few factual errors and add a few
glosses of my own]

[> > lines are by Siamak Kaveh]

> > 2. Packages and types can be made generic (parameterized through a
> > template) to help create reusable components.
>
> That is also in Fortran 90/95 AFAIK.

No, unfortunately Fortran 90/95 does not even have parameterized derived
types (Ada: record types with discriminants), much less generic subprograms
and modules. The parameterized derived types are scheduled for Fortran 2000,
I believe, but generics aren't (and this fact has been bemoaned recently in
comp.lang.fortran; see postings by William Clodius on this subject, as well
as his papers in the J3 archive repository).

> > 3. Errors can be signaled as exceptions and handled explicitly. Many
> > serious errors (such as computational overflow and invalid array
> > indexes) are automatically caught and handled through this exception
> > mechanism, improving program reliability.
>
> Yes, and this detects many errors, but I think some Fortran 90 compilers
> also checks indexes, if you ask them to do so. Maybe not as good
> as Ada.

The main difference is that Fortran does not have a good exception handling
mechanism. Some drafts of Fortran 8X did have one along the lines of Ada's
facilities, but it was left out of the final standard. (Don't ask me why;
the ultimate answer is political, in the form of "couldn't get enough votes
in favour". There are also some objective technical difficulties, though
Ada's example suggests that these can be overcome.)

Among other things, an Ada-like exception mechanism in Fortran would provide
the ability to recover from errors in allocating storage for automatic
variables, compiler-generated temporaries, etc. Currently, one can recover
from errors in explicitly coded ALLOCATE statements by using the STAT=
keyword (and even then, only if the error is immediately apparent at the
time of allocation; problems due to overcommitting swap space may still
cause the program to crash unpredictably later on) but not from much else.

> > 4. Tasks (multiple parallel threads of control) can be created and
> > communicate. This is a major capability not supported in a standard way
> > by many other languages.
>
> Yes

... although perhaps it is worth mentioning the Fortran binding to the
Message Passing Interface (MPI) standard.

> > 6.A predefined library is included; it provides input/output (I/O),
> > string manipulation, numeric functions, a command line interface, and a
> > random number generator (the last two were available in Ada 83, but are
> > standardized in Ada 95).

Note that Fortran 90/95 provides most of these facilities.
There is a command line interface proposal in the current Fortran 2000 draft.

What Fortran does not provide is direct language support for fixed-point
types (you have to implement them yourself, usually but not necessarily
with integers).

> > 2) Is there any comparison between performance of Fortran90/95 and Ada95
> > compilers?

> It is difficult to compare two different languages in a fair way. For
> example
> Ada has index checking and exception handling wich Fortran doesn't.
> You can of cause turn off these, but it's often valuable to use them,
> becase they trap bugs on an early stage, and makes the code more
> reliable Such features has a performance penalty.

I seem to recall there is some debate over whether exception handling
need entail a performance penalty when no exceptions are actually raised.
(Of course fragmenting the code into very small blocks may prevent the
optimizer from changing the order of execution.)

It goes without saying that a fair comparison would be between codes that use
equivalent features of both languages. That is, one would either turn bounds
checking on or off in both compilers. And the Ada code might use exceptions
only where Fortran has alternate returns or ERR=/END=/EOR= branches.

> But if we write comparable code in both languages, I would think that
> Fortran would win in a raw speed test, because some of the Fortran
> compilers optimize extremly well.

In other words, Fortran wins because the Fortran compilers currently on the
market are generally better at optimizing numerically intensive code than
the available Ada compilers.

It would still be nice to produce a few benchmarks (no, not TEST_FPU, please;
though TEST_FPU might actually be more useful for this purpose than for
comparing hardware platforms) to test this very plausible but I think
unconfirmed statement.

> C++ disqualifies from critical code for several reasons. Things like
> pointers and pointer aritmetrics and the possibility to cast everything to
> everything, makes the language unsafe. Many such systems must

Well, Ada also has Unchecked_Conversion if you feel so inclined.
It's use is just easier to review.

> have total control of memory usage, and no dynamic memory usage is
> allowed in many cases, and makes C and C++ is impossible to use in the
> highest safity levels. (But C is used in some safity critical stuff
> anyway, and C is widely used for embedded targets.)
>
> Fortran do not have all the weakneses of C this respect, but is still

See my remarks above about recovering from memory allocation problems in
Fortran.

Also remember that the design and testing methodology often counts for more
than the language itself. Ariane 501 was lost due to a bug in Ada code.
(My understanding is that it was an error in the specification; that the
code happened to be written in Ada was not particularly significant.)

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum




  parent reply	other threads:[~1998-09-23  0:00 UTC|newest]

Thread overview: 96+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <36068E73.F0398C54@meca.polymtl.ca>
1998-09-22  0:00 ` Fortran or Ada? Gisle S{lensminde
1998-09-22  0:00   ` Jeff Templon
1998-09-22  0:00     ` Rakesh Malhotra
1998-09-22  0:00     ` dewarr
1998-09-23  0:00       ` Jeff Templon
1998-09-23  0:00         ` Corey Minyard
1998-09-24  0:00           ` Joel Seidman
1998-09-24  0:00           ` Craig Burley
1998-09-25  0:00             ` dewarr
1998-09-25  0:00               ` Jonathan Guthrie
1998-09-26  0:00               ` Craig Burley
1998-09-26  0:00                 ` dewarr
1998-09-26  0:00                   ` Craig Burley
1998-09-26  0:00                   ` Robert B. Love 
1998-09-24  0:00         ` Marc A. Criley
1998-09-24  0:00           ` Jeff Templon
1998-09-25  0:00             ` Dale Stanbrough
1998-09-30  0:00               ` Daniel Barker
1998-09-30  0:00                 ` Lawrence Kirby
1998-10-01  0:00                   ` Aaron Crane
1998-10-02  0:00                 ` Fortran or Ada or gobbledygook? Wes Groleau
1998-10-05  0:00                 ` Fortran or Ada? Terry Devine
1998-09-25  0:00             ` dewarr
1998-09-24  0:00           ` dewarr
1998-09-24  0:00             ` Robert I. Eachus
1998-09-24  0:00               ` William Clodius
1998-09-25  0:00                 ` dewarr
1998-09-25  0:00               ` dewarr
1998-09-25  0:00                 ` Robert I. Eachus
1998-09-25  0:00                   ` dewarr
1998-09-25  0:00             ` jbs
1998-09-26  0:00               ` dewarr
1998-09-28  0:00                 ` jbs
1998-09-29  0:00                   ` William B. Clodius
1998-09-30  0:00                     ` jbs
1998-09-30  0:00                       ` William Clodius
1998-09-30  0:00                       ` dewarr
1998-09-30  0:00                         ` jbs
1998-09-30  0:00                           ` William Clodius
1998-10-03  0:00                       ` Niklas Holsti
1998-10-03  0:00                         ` Toon Moene
1998-10-03  0:00                           ` Niklas Holsti
1998-10-03  0:00                             ` Toon Moene
1998-10-04  0:00                               ` Niklas Holsti
1998-10-05  0:00                                 ` Michel OLAGNON
1998-10-05  0:00                                   ` Ian St. John
1998-10-05  0:00                                     ` dewarr
1998-10-05  0:00                                       ` Ian St. John
1998-10-06  0:00                                         ` dewarr
1998-10-06  0:00                                           ` Ian St. John
1998-10-08  0:00                                             ` Gary L. Scott
1998-10-08  0:00                                             ` Offtopic Airport Diversion (Was: Fortran or Ada?) Harold Stevens ** PLEASE SEE SIG **
1998-10-08  0:00                                               ` Ian St. John
1998-10-06  0:00                                           ` Fortran or Ada? Toon Moene
1998-10-06  0:00                                             ` Jonathan Guthrie
1998-10-06  0:00                                           ` James Giles
1998-10-06  0:00                                             ` Mark A Biggar
1998-10-06  0:00                                               ` James Giles
1998-10-07  0:00                                                 ` dewarr
1998-10-07  0:00                                             ` dewarr
1998-10-05  0:00                                     ` Richard D Riehle
1998-10-05  0:00                                       ` dewarr
1998-10-06  0:00                                     ` Michel OLAGNON
1998-10-07  0:00                                       ` Ian St. John
1998-09-29  0:00                   ` Dean F. Sutherland
1998-09-29  0:00                   ` Dean F. Sutherland
1998-09-29  0:00                   ` Dean F. Sutherland
1998-09-29  0:00                   ` Gautier.DeMontmollin
1998-10-02  0:00                   ` Geoff Bull
1998-10-02  0:00                   ` Robert I. Eachus
1998-10-02  0:00                     ` jbs
1998-10-02  0:00                       ` William Clodius
1998-10-03  0:00                         ` jbs
1998-10-03  0:00                           ` Larry Elmore
1998-10-06  0:00                           ` Robert I. Eachus
1998-10-06  0:00                             ` Pat Rogers
     [not found]           ` <6udre0$ha1$1@nnrp1.dejane <6utg60$h6l$1@nnrp1.dejanews.com>
1998-10-01  0:00             ` robin_v
1998-09-22  0:00     ` Corey Minyard
1998-09-22  0:00     ` Larry Kilgallen
1998-09-23  0:00     ` Frank Ecke
1998-09-23  0:00   ` bglbv [this message]
1998-09-23  0:00     ` Robert I. Eachus
1998-09-24  0:00       ` Richard D Riehle
1998-09-23  0:00 Marin David Condic, 561.796.8997, M/S 731-96
  -- strict thread matches above, loose matches on Subject: below --
1998-09-23  0:00 Marin David Condic, 561.796.8997, M/S 731-96
1998-09-23  0:00 ` Gisle S{lensminde
1998-09-24  0:00   ` John McCabe
1998-09-24  0:00     ` Gisle S{lensminde
1998-09-24  0:00     ` Dean F. Sutherland
1998-09-24  0:00 ` Samuel T. Harris
1998-09-24  0:00 Walt Brainerd
1998-09-25  0:00 ` dewarr
1998-09-25  0:00 ` Robert I. Eachus
1998-10-05  0:00 robin
1998-10-05  0:00 Condic, Marin D.
1998-10-05  0:00 Robert I. Eachus
replies disabled

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