3 ms·
In my view, Fortran's biggest advantage over C and C++ is its much simpler mental model. Compared against C and C++, a Fortran programmer needs to think much le
by btrettel 4y ago
In my view, Fortran's biggest advantage over C and C++ is its much simpler mental model. Compared against C and C++, a Fortran programmer needs to think much less about pointers and memory addresses. For example, Fortran procedures (functions and subroutines) are pass-by-reference, compared against C functions being pass-by-value. A Fortran programmer doesn't need to call a procedure with (C syntax) func(&x), declare the procedure with int *x, dereference the pointer with *x to get the value inside the procedure, etc. They can simply write x in all those places and it'll work. Why is pass-by-reference good in computational science? Passing large arrays by value would waste memory. Pass-by-reference is a better choice for large arrays.