long free source form lines

long free source form lines

Post by robert.cor » Wed, 26 May 2004 11:04:33


Fortran 95's free source form allows lines of at most 132
characters. The restriction is not a violation of a syntax
rule or constraint, so an implementation is free to do
whatever it wants when the restriction is violated. The
implementation is not even required to diagnose a line that
is too long.

I am interested in knowing what people would like to happen
if a line exceeds 132 characters. Possibilities include:

(1) give an error message and do not generate an object
file,

(2) truncate the line to 132 characters (this behavior
is analogous to what typically happens with fixed
source form),

(3) accept the entire line with no warning message,

(4) accept the entire line with a warning message, and

(5) accept the entire line and give a warning message
if standard conformance checking is requested.

Robert Corbett
 
 
 

long free source form lines

Post by robi » Wed, 26 May 2004 11:17:56


XXXX@XXXXX.COM (Robert Corbett) writes:

This one --

 
 
 

long free source form lines

Post by Tom Micevs » Wed, 26 May 2004 12:40:22


5 or 4.
 
 
 

long free source form lines

Post by Richard Ma » Wed, 26 May 2004 14:07:27


XXXX@XXXXX.COM (Robert Corbett) writes:


Some compilers will likely do that, so users ought to be prepared to
deal with it. I'd consider that acceptable, though I realize that
some might not.


Yuk. No. No. You're joking, right? :-) Yes, I know it often
happens with fixed source form.... and that often results in subtle
bugs that we get to find here in clf after the programmer gives up.
I have no trouble in finding work. I don't need the job security of
yet more subtle bugs that most people won't find and thus might come
to me for help with.


No. I know that the standard allows that, but I consider it a
disservice to your users to not let them know about the standard
violation even when they request standard-conformance checking.


I'd say that either of those was acceptable.

--
Richard Maine
email: my last name at domain
domain: sumertriangle dot net
 
 
 

long free source form lines

Post by Catherine » Wed, 26 May 2004 17:26:33

In article < XXXX@XXXXX.COM >, Robert
Corbett < XXXX@XXXXX.COM > writes

Any of them other than 2) - preferably a choice of several, depending on
compiler flags.

Catherine.
--
Catherine Rees Lay
To email me, use my first name in front of the "at".
 
 
 

long free source form lines

Post by Ian Bus » Wed, 26 May 2004 17:52:09


In order of preference 1, 4, 5 and then a very, very long gap to 2 and
3 both the same.

But what about

(6) accept the entire line and give an error message
if standard conformance checking is requested

?

I'd put that between 4 and 5,

Ian
 
 
 

long free source form lines

Post by Jan Vorbrg » Wed, 26 May 2004 20:10:35

> (2) truncate the line to 132 characters (this behavior

Any person(s) suggesting, or worse perpetrating such an abomination,
should be herded into a room, and summarily shot. Really 8-).


I think the latter is the best suggestion, because it offers the right
amount of flexibility: if you do not care about portability things just
work, and if you care you will be told. In that sense, I find the former
to be too intrusive for casual etc. use: I would definitely require the
ability to switch this warning, or best this class of warning, off. As a
case in point, I've always hated that DVF et al. insisted on printing the
"TAB in source line extension" warning for _ever_f*cking_single_line_ when-
ever standard conformance checking is turned. Once per file, OK - but every
single line? That's worse than a nuisance, that makes using the check
unuseable. (Steve L: please take note!)

Jan
 
 
 

long free source form lines

Post by Paul Van D » Thu, 27 May 2004 00:03:12


# (4) - but not if the portion of the line exceeding the 132 characters is part of a
comment. Standard conformance checking should be default with a switch to change that
capability (e.g. turn it off, make it strict [errors instead of warnings or cautions], etc).

Does the Sun compiler have the capability to turn off specific warning/caution/comment
messages?

cheers,

paulv
 
 
 

long free source form lines

Post by gary.l.sco » Thu, 27 May 2004 00:11:04


Correct behavior if standard conformance is requested is to truncate
at 132 characters and issue a warning message. What may be present
beyond 132 is line numbers placed there by an editor or something
similar, in which case a warning message might be annoying, so I would
limit it to the first 5 occurrences or so. If the content up to
position 132 parses without error, then an object file should be
generated. A hypothetical operating system may only support fixed
length records of some size (e.g. 512 bytes). It must be possible to
represent the Fortran statement within such a file. If the compiler
allows greater than 132 columns as an extension, I would still prefer
the above behaviour in terms of a warning message (an option to
suppress might be provided). To avoid two messages, it might apply to
whatever extended length is supported (not both at 132 columns and at
the extended length) (if unlimited, then I'd say issue warning at 132
columns). The default should never be to simply truncate at 132
columns without warning.
 
 
 

long free source form lines

Post by Jan Vorbrg » Thu, 27 May 2004 00:24:19

> Correct behavior if standard conformance is requested is to truncate

I believe this is incorrect. As I understand it, the standard requires a
compiler to support source lines _at_least_ of length 132 - it says nothing
about longer lines not being standard-conforming. Thus, the programmer
cannot _rely_ on a standard-conforming compiler to support more - but if
the compiler does so, that doesn't make the program non-conforming.

Jan
 
 
 

long free source form lines

Post by Richard Ma » Thu, 27 May 2004 01:11:23


XXXX@XXXXX.COM (Gary Scott) writes:


Correct? By what measure? I can't infer this from anything in the
standard. While it is allowed by the standard and might be a
reasonable option, I can't agree with labelling it as "correct".

I'm not particularly fond of it as an option, I might add, but
as long as the warning message is there, I'd at least accept it
as reasonable. Truncation without warning...well, I already
commented about that.

--
Richard Maine
email: my last name at domain
domain: sumertriangle dot net
 
 
 

long free source form lines

Post by Richard Ma » Thu, 27 May 2004 01:23:59

Jan Vorbrgen < XXXX@XXXXX.COM > writes:


I disagree with that interpretation. From f95 3.3.1

"In free source form, each source line may contain from zero to 132 characters..."

(The limit is processor-dependent once you add non-default characters into the
mix, basically because they may take different storage, but that's a separate
issue for now.)

While it is true that this uses only a positive form ("may"), I interpret it to
imply that lines with more than 132 characters are disallowed. I certainly don't
see any "at least" or similar words here.

Note that here, as in most places, the requirements on the compiler are indirect.
The standard phrases this as a requirement on the program. The requirement on
the compiler is then that it

"executes any standard-conforming program..."

Thus the requirement that a compiler must accept lines of at least 132 characters
is a consequence of the fact that standard-conforming programs may have lines
that long. Allowing longer lines would constitute an extension for the compiler,
but using them would make a program nonstandard (as would using most extensions).

--
Richard Maine
email: my last name at domain
domain: sumertriangle dot net
 
 
 

long free source form lines

Post by keith bier » Thu, 27 May 2004 03:27:18


yes, as one can see from a quick peek at docs.sun.com....

Option Action
...
-Xlisterr Suppress all error messages in the verification report.
-Xlisterr[nnn] Suppress error nnn in the verification report.
...
-Xlistwar Suppress all warning messages in the report.
-Xlistwar[nnn] Suppress warning nnn in the report.
 
 
 

long free source form lines

Post by glen herrm » Thu, 27 May 2004 03:28:11


(snip)


The number of printable characters on the IBM 1403 printer, then
used as a line length on many other printers.

(It may have come from printers older than the 1403.)

It is nice to be able to print source files.

But compilers I used to know (a lost tradition now) would
print a source listing file, with the lines numbered so that
they could be matched with diagnostic messages, maybe also
a cross reference indicating which variables were used on
which line.

I even knew an F66 compiler that would produce a listing indented
following the implied nesting structure, though only when
full optimization was on. It seems that the optimizer needed
the nesting structure (even if all done with IFs and GOTOs),
and it could use that in printing the listing.

The 132 character line allowed extra space before and
after each statement for such additional information.

If 132 character source lines are allowed, even wider printers
would be needed to print formatted source listings.

-- glen
 
 
 

long free source form lines

Post by Gary L. Sc » Thu, 27 May 2004 09:25:48


By truncate I mean to "utilize" the first 132 columns of relevant data.
If you read further, I indicate the need to support longer lines and not
to reject them out of hand if 1-132 contains valid statements.



--

Gary Scott
mailto: XXXX@XXXXX.COM

Fortran Library: http://www.yqcomputer.com/

Support the Original G95 Project: http://www.yqcomputer.com/
-OR-
Support the GNU GFortran Project: http://www.yqcomputer.com/

Why are there two? God only knows.

Democracy is two wolves and a sheep, voting on what to eat for dinner...
Liberty is a well armed sheep contesting the vote. - Thomas Jefferson