From: card on
On Jun 28, 7:03 pm, Lynn McGuire <l...(a)winsim.com> wrote:
> > What can Fortran do that C, C++, C# can't?
>
> > Along similar lines where would Fortran be a superior chice over C, C+
> > +, or C#
>
> None that I know of.  Here is a dated (1992) paper comparing F77,
> F90, C and C++ for engineering pgrograms:
>    http://www.leshatton.org/Documents/JSX_0192.pdf
>
> Me, myself and I, we all prefer C++.  I like strong typing and
> mandatory function prototypes.  I also like function overloading.
>

Umm. I guess I have to get my .02 cents in. I program in both, but
lately I find myself liking the F2003 standard more and more. The
simple reason being the "batteries included" of Fortran. Simply being
able to express array addition as:

A = B + C

and performing array slicing right out of the box like

A(1:5:2) = B(2:6:2)

is nice for those who want to hit the ground running. Also, blocks
like "where" and "forall" provided on the fly masks for selective
access to arrays. The list goes on. I'm a little confused about the
strongly typed comment since I consider Fortran to be strongly typed.
Also, function overloading has been in since F90. Just use a generic
interface. Both languages are excellent. I just find that Fortran
seems to get an undeserved bad wrap, but I find it to be an excellent
language for scientific computing. Just read "The Fortran 2003
Handbook" of which Richard Maine is a co-author to get a full
appreciation for the new standard.

-David
From: nmm1 on
In article <db54d0f2-aa49-4388-8c44-47c866a18fda(a)j13g2000yqj.googlegroups.com>,
card <david.car7(a)gmail.com> wrote:
>On Jun 28, 7:03=A0pm, Lynn McGuire <l...(a)winsim.com> wrote:
>> > What can Fortran do that C, C++, C# can't?
>>
>> > Along similar lines where would Fortran be a superior chice over C, C+
>> > +, or C#
>>
>> None that I know of. =A0Here is a dated (1992) paper comparing F77,
>> F90, C and C++ for engineering pgrograms:
>> =A0 =A0http://www.leshatton.org/Documents/JSX_0192.pdf
>>
>> Me, myself and I, we all prefer C++. =A0I like strong typing and
>> mandatory function prototypes. =A0I also like function overloading.

All available in Fortran 90, let alone 2003.

>Umm. I guess I have to get my .02 cents in. I program in both, but
>lately I find myself liking the F2003 standard more and more. The
>simple reason being the "batteries included" of Fortran. Simply being
>able to express array addition as:
>
>A = B + C
>
>and performing array slicing right out of the box like
>
>A(1:5:2) = B(2:6:2)
>
>is nice for those who want to hit the ground running. ...

C++'s array handling is dire, as with all such languages. If you
need to do a lot of non-trivial matrix work, there is simply no
competition - Fortran beats C++ into a cocked hat.

The main other areas where Fortran has facilities that C++ lacks
that I can think of are debuggability and optimisability (which
are closely related). Even modern Fortran is poor, but C++ is
hopeless - on the former, if either you or the implementor makes
a mistake, heaven help you - on the latter, that's why OpenMP
Fortran is much better than the C version and the C++ version
is really just the C one with brass knobs on. Complex arithmetic
is a lot better, too.

Of course, there are many things that C++ has that Fortran lacks,
some of which cause even diehard Fortran programmers to have
trouble. Free-format input (and I/O flexibility, generally) and
flexible, lightweight character string handling, to name but two.


Regards,
Nick Maclaren.
From: sturlamolden on
On 29 Jun, 00:25, rfengineer55 <rfenginee...(a)aol.com> wrote:

> What can Fortran do that C, C++, C# can't?

Nothing, except save the numerical programmer from pain and suffering.

And for anything else there is Python.



From: Lynn McGuire on
>>> Me, myself and I, we all prefer C++. =A0I like strong typing and
>>> mandatory function prototypes. =A0I also like function overloading.
>
> All available in Fortran 90, let alone 2003.

Are strong typing and function prototypes mandatory in Fortran 90 ?

You can force typing by adding "implicit none". But is it strong
typing ?

> C++'s array handling is dire, as with all such languages. If you
> need to do a lot of non-trivial matrix work, there is simply no
> competition - Fortran beats C++ into a cocked hat.

Can you give an example of this ?

> The main other areas where Fortran has facilities that C++ lacks
> that I can think of are debuggability and optimisability (which
> are closely related). Even modern Fortran is poor, but C++ is
> hopeless - on the former, if either you or the implementor makes
> a mistake, heaven help you - on the latter, that's why OpenMP
> Fortran is much better than the C version and the C++ version
> is really just the C one with brass knobs on.

Can you give an example of this ?

Thanks,
Lynn
From: nmm1 on
In article <i1kl9f$cub$1(a)news.eternal-september.org>,
Lynn McGuire <lmc(a)winsim.com> wrote:
>>>> Me, myself and I, we all prefer C++. I like strong typing and
>>>> mandatory function prototypes. I also like function overloading.
>>
>> All available in Fortran 90, let alone 2003.
>
>Are strong typing and function prototypes mandatory in Fortran 90 ?
>
>You can force typing by adding "implicit none". But is it strong
>typing ?

About as much as in C++ - i.e. not very, in both cases. But there's
essentially no systematic difference, and only the details of what
you have to do differ. However, the do differ (wildly) and both
have serious loopholes in their type systems.

>> C++'s array handling is dire, as with all such languages. If you
>> need to do a lot of non-trivial matrix work, there is simply no
>> competition - Fortran beats C++ into a cocked hat.
>
>Can you give an example of this ?

Trivially. I have a 10x10 matrix, and I want to pass the 4x4 centre
to a routine that expects a normal 4x4 matrix. If you use entirely
modern Fortran (i.e. assumed-shape arrays), that doesn't even copy
the data when doing that. C++ has no equivalent - and, no, gslice
does not cut the mustard.

>> The main other areas where Fortran has facilities that C++ lacks
>> that I can think of are debuggability and optimisability (which
>> are closely related). Even modern Fortran is poor, but C++ is
>> hopeless - on the former, if either you or the implementor makes
>> a mistake, heaven help you - on the latter, that's why OpenMP
>> Fortran is much better than the C version and the C++ version
>> is really just the C one with brass knobs on.
>
>Can you give an example of this ?

While I can, if you need them, I doubt that it would help.

The debuggability issues are largely because the C++ standard has
a lot more ambiguities than the Fortran one (and what it inherits
from C has VASTLY more) and requires the compiler to diagnose a
smaller proportion of the potential errors.

The two main optimisability aspects are aliasing and serialisation,
which I will give very simple examples of:

In Fortran, if two arguments overlap IN ANY WAY and are not flagged
as potentially aliasing each other, neither may be written to.
That is not the case in C++, so it can't use that for optimisation.

C++ requires all function calls, implicit and explicit, to be executed
in some sequential order. Fortran does not, and they may be reordered
or even omitted.


Regards,
Nick Maclaren.