- #1
mrentropy
- 9
- 0
Fortran90 vs C vs C++: not a troll!
Ahhh, yes, the perennial debate that leads inevitably to broken bottles and fisticuffs. I'm being quite sincere here, though, although I'm sure the end of the thread may be ignoble.
What I'm wondering is this:
--->> What are the ADVANTAGES of Fortran90/95 over C/C++ as far as codability is concerned, NOT raw power? Are there any? <<----
By far the most intriguing part of F90 is the module, which grew out of common blocks. It's a neat idea and I really like it, but on the other hand, Fortran seems to suffer from the fact that importing a module means the module's namespace walks all over your local namespace, in contrast with Python, say, where you can do "import foo" to make a qualified namespace instead of "from foo import *", to avoid namespace collisions.
And then, in C++, you can really avoid namespace problems by making your procedures methods instead, so that there's no confusion between fooobj.sort() and barobj.sort(), for example, if fooobj is an instantiation of class foo, likewise for bar, and foo and bar classes both have sort methods. To me, that seems to make life simpler.
Perhaps this is why when I try to do things like make a doubly linked list in Fortran 90, it confuses the heck out of me and I end up wrapping modules in modules, and I get namespace problems, whereas in C++ it seems rather straightforward.
I need to write a big number crunching physics code (don't ask) and I know from prior experience that once you start getting near the 100,000+ line code level, the language features that were minor annoyances before can become major headaches. When codes get that big, namespace encapsulation is key IMLE.
What I'd like is for SOMEBODY out there to try to convince me that for big numeric codes the Fortran 90 module is great for making truly manageable, modular code, where you aren't liable to find yourself inadvertently walking all over namespace with muddy boots mucking the rest of your code up... Somehow part of me wants to believe that, somehow or another, there's something inherent about working with a big huge STATE space (that is, the internal representation of some PDE on a huge mesh, particle trajectories, etc) that amends itself well to Fortran90 modules.
The other stuff - simple multi-array support, complex number support, fast integer power, side-effect free sqr(), that stuff isn't that important to me. It's a shortcoming of C that it doesn't have those, and it's a pain, but I can work around it. And things like 20% speed diffs just don't seem that important to me when the biggest speedup for my sort of programming comes from being able to get something *working* fast and using smart parallel algorithms that don't lock up (I'm using MPI on a beowulf...)
So please, Fortran90 fans, save me from my evil C/C++ ways and tell me what I really get with the f90 module that I don't get with those languages.
Thanks...
Ahhh, yes, the perennial debate that leads inevitably to broken bottles and fisticuffs. I'm being quite sincere here, though, although I'm sure the end of the thread may be ignoble.
What I'm wondering is this:
--->> What are the ADVANTAGES of Fortran90/95 over C/C++ as far as codability is concerned, NOT raw power? Are there any? <<----
By far the most intriguing part of F90 is the module, which grew out of common blocks. It's a neat idea and I really like it, but on the other hand, Fortran seems to suffer from the fact that importing a module means the module's namespace walks all over your local namespace, in contrast with Python, say, where you can do "import foo" to make a qualified namespace instead of "from foo import *", to avoid namespace collisions.
And then, in C++, you can really avoid namespace problems by making your procedures methods instead, so that there's no confusion between fooobj.sort() and barobj.sort(), for example, if fooobj is an instantiation of class foo, likewise for bar, and foo and bar classes both have sort methods. To me, that seems to make life simpler.
Perhaps this is why when I try to do things like make a doubly linked list in Fortran 90, it confuses the heck out of me and I end up wrapping modules in modules, and I get namespace problems, whereas in C++ it seems rather straightforward.
I need to write a big number crunching physics code (don't ask) and I know from prior experience that once you start getting near the 100,000+ line code level, the language features that were minor annoyances before can become major headaches. When codes get that big, namespace encapsulation is key IMLE.
What I'd like is for SOMEBODY out there to try to convince me that for big numeric codes the Fortran 90 module is great for making truly manageable, modular code, where you aren't liable to find yourself inadvertently walking all over namespace with muddy boots mucking the rest of your code up... Somehow part of me wants to believe that, somehow or another, there's something inherent about working with a big huge STATE space (that is, the internal representation of some PDE on a huge mesh, particle trajectories, etc) that amends itself well to Fortran90 modules.
The other stuff - simple multi-array support, complex number support, fast integer power, side-effect free sqr(), that stuff isn't that important to me. It's a shortcoming of C that it doesn't have those, and it's a pain, but I can work around it. And things like 20% speed diffs just don't seem that important to me when the biggest speedup for my sort of programming comes from being able to get something *working* fast and using smart parallel algorithms that don't lock up (I'm using MPI on a beowulf...)
So please, Fortran90 fans, save me from my evil C/C++ ways and tell me what I really get with the f90 module that I don't get with those languages.
Thanks...
Last edited: