On Sun, 16 Mar 2025 21:07:39 +0100
Simon Sobisch <simonsobi...@web.de> wrote:

> This gives three reference-formats: "fixed" "free" and "extended". For
> two of those we have seen the flags -ffixed-form and -ffree-form, so
> I'd _guess_ the last one would be -fextended-form.
> 
> Question: Is there a reason to have multiple flags for that? 

[I think this thread belongs in gcc@ because there's no patch to
discuss.  I'm answering here for the sake of continuity.]

-ffixed-form and -ffree-form are the names gfortran uses.   To get
"logical reference format" -- unlimited lines with the first 6 columns
ignored and indicator column 7, we have 

        -findicator-column=7

It's not a great name, not least because it seems
invertible but is not.  ("-fno-indicator-column=n" makes no sense.)
OTHO it says what it means: the location of the indicator column, with
no mention of a line length limit (because there isn't one). 

> -fformat=fixed/free/extended/.../auto

The problem here IMO is the burden of names.  Each combination of
left/right margin needs a name, all of which are arbitrary.  "Extended"
from what, and to what?  Every compiler seems to have its own
variation. 

If -- if -- we were to support other formats I'd be inclined to use 

        -source-format from[-to]

so the user says where the indicator column is, and what the maximum
length is, if any.  So, 

        -ffixed-form    is  -source-format 7-72
        -ffree-form     is  -source-format 1
        (logical ref)   is  -source-format 7
        (no indicator)  is  -source-format 0

with the implied rule that, if the first column is 1, then '*' is
honored as a comment, else the character is part of the COBOL text.  

> Side-note: auto-choosing "extended" was at least confusing for me (and
> the NIST suite initial compile-try). That likely confused me most,
> because of not knowing another compiler choosing _that_ format
> automatically.

There must be some default, and auto-detection is a good one.  It can
be improved without changing the command-line options.  :-)   I'm
looking forward to more examples before tweaking it.  

--jkl

Reply via email to