[Info-vax] Is C++ good in scientific computation? Why did Fortran lose its popularity?

ultr...@gmail.com ultradwc at gmail.com
Sat Jan 23 14:35:39 EST 2021


Very good comparison by a Former member of ISO/ANSI J3 Fortran Standards Committee begs the question how C ever became the choice to do anything

https://www.quora.com/?digest_story=120247733&source=4

Craig Dedo January 30, 2019
Former member of ISO/ANSI J3 Fortran Standards Committee

Is C++ good in scientific computation? Why did Fortran lose its popularity?

Before I answer, I’ll let readers know that I’m biased on this issue. I’m not a big fan of C++ and I am a big fan of Fortran.

I generally do not consider C++ to be a good choice for scientific computation or for many other software application areas. I believe that it is “popular” largely because it was one of the first major OOP languages and it is closely related to C, the premier low-level system programming language. C++ has a number of serious weaknesses. Among them are:

    C++ is a proper superset of C. Among other things, that means that a pointer can point at anything. This limits opportunities for optimization. A lot of scientific and engineering programming of industrial-sized applications involves lots of floating-point calculations so often run-time efficiency is crucial.
    The grammar and syntax of C++ is difficult and complex so it is easy even for experienced programmers to make serious and costly mistakes.
    The architecture of the OOP features is often clumsy and difficult to use.

In contrast, Fortran avoids these kinds of shortcomings. Consider:

    Fortran has rules that provide lots of opportunities for run-time efficiency. A pointer can point only at a target that has either the POINTER or TARGET attribute AND is of the same type, kind, and rank. This means that non-pointer and non-target data objects can be subject to entire classes of additional optimizations. And, Fortran allows whole array and array slice operations so these can be optimized.
    The grammar and syntax of Fortran was intentionally designed so that it would be easy to use for a non-expert application developer.
    The OOP features were intentionally developed using the best known practices for OOP features as they existed in the late 1990s. I know because I was there when it happened.

Why has Fortran declined in relative popularity compared to other popular programming languages? There are several closely related reasons. The most important reason has to do with the history of Fortran.

Resistance to New Features. Fortran was originally designed in 1954 and the first compiler released in 1956. Due to the limitations of the hardware in those days, the feature set of Fortran had to be kept very small. Gradually more features were added in the next few years and eventually Fortran was standardized as an American National Standard in 1966 and as an ISO Standard a few years later (FORTRAN 66). Shortly after the first standardization of Fortran, computer scientists began developing newer and more powerful programming features such as control structures, data structures, and pointers.

The ISO committee that developed the next ISO Standard, FORTRAN 77 had an intense debate over the size and scope of the language. The large language people wanted to incorporate many of the features that the computer scientists wanted and to relax many of the restrictions that existed in FORTRAN 66 such as limiting names to 6 characters. The small language people wanted to add only a few select features. The small language people generally won the argument. As a result, many computer scientists moved away from Fortran and on to other languages, first Pascal, then in succession, C, C++, and Java.

What followed was a 14-year knock-down, drag-out fight over the size and scope of the Fortran programming language. Eventually the large-language people won and the result was Fortran 90, which was published in June 1991. It included a long list of features that had proven their worth in the preceding 20 years along with some useful features, such as user-defined generic procedures and user-defined operators, that are rarely found in other languages.

Unfortunately, the small-language people did not accept defeat gracefully. Instead, they launched a scorched-earth resistance and harshly criticized the new version of Fortran. Thus, many influential people in the software development community turned against Fortran. They did not give it a fair chance to compete.

Unfortunately this damage continues to the current day in spite of the fact that the small-language people have nearly disappeared and since then there have been 4 new ISO Standards published: Fortran 95, 2003, 2008, and 2018.

Lack of a Politically Powerful Champion. Many of the most successful programming languages have a politically powerful champion or sponsor. Consider these examples:

    C has legions of low-level systems programmers and many computer scientists.
    C++ has Bjarne Stroustrup, many computer scientists, and Microsoft.
    Ada has the US Department of Defense.
    Visual Basic and C# have Microsoft.
    Java originally had Sun Microsystems and now has Oracle.

Fortran has no politically powerful sponsor or champion. There is no highly influential person or organization in the software development community that is pushing strongly to make Fortran much more popular. The history of spoken and written languages shows that the popularity of languages is largely based on the political clout of the language’s native speakers. Consider the case of Latin 2000 years ago and English today. I strongly suspect that the same is true with computer programming languages.



More information about the Info-vax mailing list