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

Fixed form, Tab Form clarifications

jimdempseyatthecove
Honored Contributor III
694 Views

In reading the IVF documentation, I'd like some clarification

1) The compiler option switches have /fixed and /free, but no switch to indicate if tab format. Are tab formatted lines freely interchangeable within fixed format lines of fixed format files?

2) The IVF documentation assumes well formatted lines, what is the behavior of the following two lines containing:

     <Tab>A = B +
     <Space><Tab>1 C

Is the above a valid continuation line?

3) The documentation states that a ; followed by a comment (!) is to be ignored. Does this hold true if a space(s) and/ or tab(s) lie between the ; and !?

Jim Dempsey

0 Kudos
5 Replies
Steve_Lionel
Honored Contributor III
694 Views

1) Tab format is a variant of fixed-form, and is handled on a line by line basis. It is an extension, of course

2) The documentation says it is valid continuation.

3) Yes, but I'm unsure why the documentation calls that out. I can't find words in the standard that connect the two. 

0 Kudos
jimdempseyatthecove
Honored Contributor III
694 Views

Thanks, the documentation states

For tab form: Any digit (except zero) after the first tab

This, taken literally could mean:

     <Tab>A = B +
      arbitraryTextHere<Space><Tab>1 C

Is a valid continuation line. (first character following first tab is digit other than 0).

I do not think the comment is to be taken literally. Rather, I think the interpretation is to be:

   <0 to 4 spaces><Tab>1 C

While you may think this question is absurd, consider trying to write a fixed/tab for to free form parser.

Think of something worse than IanH's FIXEDFORMFOREVER.FOR.

His file did not have these goofy continuation lines. But it did have rather difficult syntax to say the least.

Jim Dempsey

0 Kudos
Steve_Lionel
Honored Contributor III
694 Views

I agree that you can't have characters other than blank before the first tab. I tested it and a blank before the tab is ok.

0 Kudos
jimdempseyatthecove
Honored Contributor III
694 Views

Steve,

Another esoteric question regarding tabs.

Fixed form:

<tab>A=Expression;<tab>Expression;...

Assume rules for 72 character lines are in place.

I assume in the above, the first tab "consumes" 6 characters of the 72 character line. (First tab rule)

What does the 2nd tab consume?

1 character position .OR. to the next "usual" tab position (9, 17, 25, 33, ...) .OR. to the next tab position of some editor unknown?

Reason for question is to resolve is to determine at which point in fixed/tab formatted file characters become comment.

Jim Dempsey

0 Kudos
Steve_Lionel
Honored Contributor III
694 Views

Jim, you'll find that different implementations interpret the tabs differently. Intel Fortran considers a tab to be a single character for the purpose of fixed-form line length. I know of other compilers that take the "tab stop" approach.

The answer really is: "Don't use tab form!" There's no excuse for using it nowadays. If your question is from the perspective of writing a converter, I suggest having an option for how tabs are to be treated since compilers differ. I would hope, though, that nobody mixes tab form with comments past "column 72" ,which isn't really specified in the standard either. From the standard's perspective, a fixed-form source line is exactly 72 characters, no more, no less. When we were all using punch cards, that didn't matter so much, but with variable-length source records from text editors, how you deal with line lengths less than 72 is open for interpretation. Consider:

bbbbb PRINT *, 'HOW MANY SPACES
bbbbb1IS THIS?'

where "b" is a blank.

If this was on punch cards, there would be a bunch of spaces between "SPACES" and "IS". With variable-length source records, do you pad the line to column 72 or not? This is why we invented /pad_source so many years ago, as implementations disagreed on the default behavior.

0 Kudos
Reply