为什么 Fortran Standard 中的最大单行长度限制为 132 个字符? [英] why is maximum single-line length limited to 132 characters in Fortran Standard?

查看:17
本文介绍了为什么 Fortran Standard 中的最大单行长度限制为 132 个字符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是关于性能、干净的源代码、编译器……吗?我知道许多编译器允许更长的单行代码.但是,如果这个扩展是可能的,没有任何妥协,那么为什么 Fortran 标准严格遵守这个规则呢?

我知道这是一个非常笼统的问题(stackoverflow 警告我,考虑到它的标题,这个问题可能会被否决),但我找不到任何资源来解释现代 Fortran 标准中最大长度为 132 个字符背后的逻辑.

2019 年 10 月 22 日更新:参见

Is it about performance, clean source code, compilers, ...? I know that many compilers allow longer single-line codes. But, if this extension is possible without any compromise, then why does Fortran standard strictly adhere to this rule?

I know that this is very general question (stackoverflow warns me that this question might be downvoted given its title), but I cannot find any resources that explain the logic behind a max length of 132 characters in modern Fortran standard.

Update Oct 22, 2019: See https://j3-fortran.org/doc/year/19/19-138r1.txt for a proposal accepted as a work item for the next 202X revision of the Fortran standard, which eliminates the maximum line length and continuation limits.

解决方案

Take a look at specification:

ftp://ftp.nag.co.uk/sc22wg5/N001-N1100/N692.pdf

section: 3.3.1

It's just convention. Somebody decided that 132 will be ok. In 66 version it was 72.

Standards: https://gcc.gnu.org/wiki/GFortranStandards#Fortran_Standards_Documents

Usually, these limitations (like 80, 132 characters per line), were dictated by terminals.

Just to illustrate, in a "funny" way, how was it to code in 90's ;)

这篇关于为什么 Fortran Standard 中的最大单行长度限制为 132 个字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆