How can I change the maximum length of a programming line in fortran and C (specifically in fortran 77)?
Seems the default maximum length is 72 in fortran 77.
Thanks.
How can I change the maximum length of a programming line in fortran and C (specifically in fortran 77)?
Seems the default maximum length is 72 in fortran 77.
Thanks.
Without knowing what compiler you're using, there is no way to know if there is an option for your FORTRAN compiler to accept non-standard input line formats. (The FORTRAN 66 and 77 languages basically assumed that programs were entered into a system on 80 column punched cards. And, the last 8 columns were reserved for comments.) Most C compilers have no limit other than the fact that C source files are text files and text files have a maximum line length of LINE_MAX bytes including the terminating <newline> character. (You can find the value of LINE_MAX on your system by running the command: getconf LINE_MAX
.)
The best way to determine if there is an option on your compiler is to read the man page on your system for your compiler. If you invoke your compiler by executing f77
, then the command: man f77
should give you the man page for your compiler.
getconf LINE_MAX
gives
2048
Right now I am using Intel fortran compiler (ifort).
Hi.
For my system:
OS, ker|rel, machine: Linux, 2.6.26-2-amd64, x86_64
Distribution : Debian GNU/Linux 5.0.8 (lenny)
ifort (IFORT) 11.1 20090827
From man ifort, q.v.:
-noextend-source
Specifies the length of the statement field in a
fixed-form source file.
Architectures: IA-32, Intel 64, IA-64 architectures
Default:
72 If you do not specify this option or you
specify noextend-source, the statement
field ends at column 72.
132 If you specify extend_source without
size, the statement field ends at column
132.-
Description:
This option specifies the size (column number) of the
statement field of a source line in a fixed-form source
file. This option is valid only for fixed-form files; it
is ignored for free-form files.
When size is specified, it is the last column parsed as
part of the statement field. Any columns after that are
treated as comments.
If you do not specify size, it is the same as specifying
extend_source 132.
Option Description
extend-source 72 Specifies that the statement
field ends at column 72.
extend-source 80 Specifies that the statement
field ends at column 80.
extend-source 132 Specifies that the statement
field ends at column 132.
Google and man pages are your friends, as Don Cragun wrote.
Coding at longer, non-standard widths may cause lines to be displayed on more than one line in a wrapped fashion, inhibiting comprehension. Think about maintainability.
Best wishes ... cheers, drl
Thanks. But what will be compilation command? Is it something like:
ifort --extend-source 132 <filname>.f
?