What advantages does modern Fortran have over modern C++?(与现代 C++ 相比,现代 Fortran 有哪些优势?)
问题描述
我正在尝试在 Fortran 和 C++ 之间为科学计算应用程序做出决定.我不清楚 Fortran 在性能方面是否仍然优于其他语言.例如,我相信由于 Fortran 强制执行严格的别名,与 C99 之前的 C 相比,编译器可以进行更好的优化.我不确定 C++ 如何适合这里.
I'm trying to decide between Fortran and C++ for an application in scientific computing. It's not clear to me if Fortran still has advantages over other languages when it comes to performance. For example, I believe since Fortran enforces strict aliasing, better optimizations could be made by the compiler when compared to C before C99. I'm unsure of how C++ fits in here.
有什么指导吗?
推荐答案
我看了 一些最新的 Fortran 标准中的东西,坦率地说,我印象深刻.20 年前我讨厌这门语言的很多东西现在都消失了.没有更多的行号和特殊的列(可能他们在地狱中燃烧).
I took a look at some of the stuff in the latest Fortran standards, and frankly I'm impressed. A lot of what I hated about the language 20 years ago is gone now. No more line numbers and special columns (may they burn in hell).
Fortran 已经在工程界广泛使用了 50 年.如果你在这些圈子里工作,这会给你两个好处.首先,这些人非常关心优化.这意味着 Fortran 编译器往往拥有最好的优化器.由于没有别名,该语言本身也比 Cish 语言更易于优化.
Fortran has been heavily used in engineering circles for 50 years now. That gives you two advantages if you work in those circles. First off, these folks care a lot about optimization. That means Fortran compilers tend to have the best optimizers around. The language itself is a lot more optimizable than Cish languages too, thanks to its lack of aliasing.
第二个优势是 Fortran 库对数字运算的支持是无与伦比的.最好的代码几乎总是经过良好调试的您不必编写的代码.
The second advantage is that Fortran's library support for number crunching simply cannot be beat. The best code is nearly always going to be the well-debugged code you don't have to write.
如果您的应用程序一般不属于科学、工程或数字运算的范畴,那么上述任何一项对您来说都不是什么大不了的事,因此您最好去别处寻找.
If your application doesn't fall under scientific, engineering, or number crunching in general, then neither of the above will be a big deal for you, so you may be better off looking elsewhere.
这篇关于与现代 C++ 相比,现代 Fortran 有哪些优势?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:与现代 C++ 相比,现代 Fortran 有哪些优势?


基础教程推荐
- 如何在 C++ 中初始化静态常量成员? 2022-01-01
- 我有静态或动态 boost 库吗? 2021-01-01
- 如何将 std::pair 的排序 std::list 转换为 std::map 2022-01-01
- C++结构和函数声明。为什么它不能编译? 2022-11-07
- 常量变量在标题中不起作用 2021-01-01
- 如何通过C程序打开命令提示符Cmd 2022-12-09
- 静态库、静态链接动态库和动态链接动态库的 .lib 文件里面是什么? 2021-01-01
- 如何检查GTK+3.0中的小部件类型? 2022-11-30
- 在 C++ 中计算滚动/移动平均值 2021-01-01
- 这个宏可以转换成函数吗? 2022-01-01