This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Error: Invalid form of array reference at (1)


Am 08.02.2011 21:43, schrieb Steve Kargl:
                        1
Error: Invalid form of array reference at (1)


So, yes, your lines are too long. IMNSHO, anything over 80 characters is too long.

The Fortran standard allows only 132 characters in free-form source code and 72 in fixed-form source code. Thus, it is not surprising that you get such an error exactly in column 132. As Steve already wrote, you should split long lines using an ampersand (&) as last character in the line which should be continued.


Alternatively, you can ask gfortran to accept longer line lengths using, e.g., -ffree-line-length-none (or -ffree-line-length-<n> where "<n>" is a number).

Regarding the number 80: I read in the gfortran manual that 80 matches old card images and it is also a typical width of many terminals. Thus, restricting one to maximally 80 characters is a good practice and also GNU coding style (for C). However, in terms of Fortran only 72 and 132 are the magic numbers.

Tobias


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]