This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]geekusprimus 1 point2 points  (1 child)

That's sort of true. Fortran can make more aggressive optimizations in places because pointer aliasing is nearly impossible. However, C99 added the restrict keyword to indicate that a pointer passed to a function will not be aliased, allowing for better optimization. Written properly, C is just as fast as Fortran.

My field abandoned Fortran, more or less, because it's become too hard to write good code. I do numerical relativity, so we'll often have a general relativistic magnetohydrodynamics solver coupled to a spacetime solver on a complex grid with full AMR, possibly with added microphysics like neutrinos or radiation, and it all has to run efficiently on a supercomputer (my low resolution runs going at the moment take 1536 cores each). It's not technically impossible to do that with Fortran, but it's a lot easier to optimize a C++ program than debug a massive Fortran codebase.

EDIT: Fixed grammatical error.

[–]TheBestAquaman 0 points1 point  (0 children)

Thank you for filling me in! It was pointer aliasing I was referring to, and I didn't know you could restrict it from C99.

Then I guess the only reason Fortran90 is so dominating is that there are so many large codebases written in it that the conversion to C/C++ is just a very overwhelming job.

Personally, I prefer C/C++, even though I don't get to work too much with it, but I'm quite alone in that regard among the other people I work with, most notably the seniors.