Re: closing unit=5 and unit=6 and print *



Dylan Sung wrote:
I've noticed what seems to be a bug in the g77 compiler that comes with Lepsh's Force 2.0 Editor and Compiler. If you open files using the unit numbers 5 and 6, and then later close them, you cannot use 'print *' to output messages to the screen dos console window. Later, altering those unit numbers to 7 and 8 for the filenames I wanted to use, the print * ouput worked again.

After some reading, it seems to me if I've understood it correctly, that unit numbers 5 and 6 are used for screen or device driven input and output in f77. Can anyone elaborate on this, and is this a general f77 thing or specific to the build of g77 I have been using?

According to my understanding, in f77 and subsequent standards, unit=* is required to be independent of positive numbered units in the available contiguous range. Prior to f77, as unit=* was not generally available, the substitution of pre-assigned units 5 and 6 was usual practice (never codified as a standard). If you check the record of c.l.f, you will see repeated expert advice not to use single digit units, for just such reasons, regardless of the standard.
It may be tempting to use units 5 and 6 in the expectation that they will be pre-assigned in this fashion, while allowing the program to redirect at will. Such a practice would be less portable than using unit=* and relying on the redirection supported by most operating systems.
As g77 has not been maintained for some time, correction of such a problem in that compiler is not to be expected.
.