Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29396 Discussions

Free Format vs. Fixed Format Performance, Line Length

Ernie_P_1
Beginner
1,907 Views
Hi,

I suspect that most programmers are trending towards using free format, but I don't know. Is this the case nowadays?

Is there a difference in performance if a programuses fixed or free format?

If using fixed format, does the form line length affect performance, or is it just the programmer's preference if he/she uses 72,80, or 132 columns?

Thanks,
EP
0 Kudos
2 Replies
Steven_L_Intel1
Employee
1,907 Views
No difference in performance. Free format is preferred as it helps avoid some common coding errors that the compiler would not notice if fixed-form were used. Note that free-form source allows at least 132 columns.

Fixed-form source is "deprecated" in the current standard and should not be used for new code. I would especially warn against using compiler extensions to provide for fixed-form line lengths greater than 72 - this will definitely bite you later (if not sooner.)
0 Kudos
jimdempseyatthecove
Honored Contributor III
1,907 Views

I'm with Steve. Go with Free Format. I've been bitten too many times where a line is truncated at 72 columns where the truncated resultant line will compile just fine and without any warning. Dropping digits off of constants are one thing truncating an expression is another. You can look at

out = (some realy long expression) * TEMP3

with the 3 chopped off and without error message and not find the error. In Visual Studio with intilepoint hovering the mouse over TEMP3 will show TEMP3 as seen and not TEMP as used.

Save your self some time later and go with free format.

The only "problem" you might expect is in the sections where you do data initialization using continuation lines. This will take a little rework but it is not all that bad.

Jim Dempsey
0 Kudos
Reply