-frecord-marker
Brooks Moses
bmoses@stanford.edu
Thu Jul 20 17:43:00 GMT 2006
Keith Bennett wrote:
> On Thu, Jul 20, 2006, Adrian Umpleby wrote:
>>I just think that the possibility of specifying per-unit record marker formats is very useful.
>>(Clearly so, since I can't actually do what I want with just -frecord-marker as it stands at the
>>moment.)
>
> Maybe, but you would also be able to do what you want if -frecord-marker
> worked at compile-time for non-main objects. I think that's the real fix
> for this problem. (I know - easier said than done!)
I don't see that as preferable to Adrian's suggestion, for a couple of
reasons. Consider, for the sake of argument, a small program which
reads in a file with one marker format, and writes it immediately back
out with a different format.
First, a critical part of the program behavior is in what record-marker
format it uses when it opens the files. Adrian's suggestion puts this
information in the source code, with the OPEN statement, where it's
relevant; this ensures that it's clear to someone reading the code, and
will always be done correctly. Keith's suggestion puts the information
in the command line when the compiler is called, which is separate from
the code and is only saved at all if one's using some form of makefile
or the equivalent. I think that this makes a very dramatic difference
in the long-term maintainability of the code.
Second, suppose that a file is opened in a program unit that is compiled
with one -frecord_marker setting, and then the unit number is passed to
another program unit (compiled with a different setting) which reads
from it. While the obviously-correct functionality here is that the
record marker format for a file should be set at the time it is opened,
and that that should persist even if it is accessed in a program unit
compiled with a different record marker format, I do not think the
syntax makes it at all clear to the user that this is what will actually
happen in practice.
I think it's also worth noting that Adrian's suggestion, at least in
syntax, allows for the posibility of selecting the marker type at runtime.
- Brooks
More information about the Fortran
mailing list