Maximum length of a line


 
Thread Tools Search this Thread
Top Forums Programming Maximum length of a line
# 1  
Old 01-05-2013
Maximum length of a line

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.
# 2  
Old 01-05-2013
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.
# 3  
Old 01-05-2013
Quote:
Originally Posted by Don Cragun
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).
# 4  
Old 01-05-2013
Hi.

For my system:
Code:
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.:
Code:
       -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
# 5  
Old 01-05-2013
Thanks. But what will be compilation command? Is it something like:

ifort --extend-source 132 <filname>.f ?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Maximum length of a string

good friends days I would love to know if I can help you know the length of a string example: cadena= "cual es mi largo" echo "cadena : $cadena# cadena :16 (7 Replies)
Discussion started by: tricampeon81
7 Replies

2. Shell Programming and Scripting

Is there a maximum length for a shell script command?

Is there a maximum length for a shell script command? How can I detect that in my OS? For example, if I have something like: command A | command B | command C | awk '{print $1 $2 $3 $4 $5}' then can we break the commands and also the arguments inside awk ? Thanks (11 Replies)
Discussion started by: hbar
11 Replies

3. Shell Programming and Scripting

Maximum command length in bourne shell

Hi, I wanted to know what is the maximum length of command which can be run on a bourne (sh) shell? Where can I find that information? Is it different for different OS flavors? Please help. Thanks, Vineet (10 Replies)
Discussion started by: vineetd
10 Replies

4. UNIX for Dummies Questions & Answers

How to increase the maximum record length

Hi, I need to create a file of record length more than 300 characters. But in my unix box, i am able to create a file only with a maximum of 256 characters per record. Is there anyway i can create a file with more than 300 characters in this case? Or How to increase the maximum record... (1 Reply)
Discussion started by: mahish20
1 Replies

5. Shell Programming and Scripting

what is the maximum length of a unix shell variable which can be can passed to plsql

what is the maximum length of a unix shell variable which can be can passed to plsql variable:( (1 Reply)
Discussion started by: alokjyotibal
1 Replies

6. UNIX for Dummies Questions & Answers

Maximum length of a path given as an argument to a shell script

hi, I am using solaris10. I have to write a bourne shell script, which copies files for the said destination path which is passed as an argument to the script. it looks like this myscript.sh /var/test -->destination path now i would like to know what is the maximum length i can... (3 Replies)
Discussion started by: raghu.amilineni
3 Replies

7. UNIX for Dummies Questions & Answers

what is the maximum length of th os-command line in Unix.

Hi All, I didn't find any thread that match this question so I hope it's not redundant. I am totally new to Unix. I want to know what is the maximum length of the os-commandline in Unix. Will it cause any problem if I run any application whose total path length is much longer than 256... (2 Replies)
Discussion started by: kumardesai
2 Replies

8. UNIX for Dummies Questions & Answers

Maximum Command Length

What is the maximum size of a command which can be given in telnet command prompt in unix? (2 Replies)
Discussion started by: miltony
2 Replies

9. UNIX for Dummies Questions & Answers

Maximum Command Length for Korn shell

What is the maximum size of a command which can be given in telnet command prompt in unixfor Korn shell? (2 Replies)
Discussion started by: miltony
2 Replies

10. UNIX for Dummies Questions & Answers

Maximum file name length

Hi folks, Can anybody tell me whether there is any limit on the file name length and directory name length in UNIX. (4 Replies)
Discussion started by: rkkiran
4 Replies
Login or Register to Ask a Question