This is the mail archive of the
mailing list for the GCC project.
Re: [Patch, fortran] PR28585: Add Fortran 2003 NEW_LINE intrinsic function
FX Coudert wrote:
I also need to go read the F2003 standard to see
what this intrinsic does because its name suggests that gfortran
can constant-fold the intrinsics away.
I'm a bit worried that not all systems supported by gfortran use \n
as newline. E.g., i386-pc-mingw32 uses \n\r.
This is irrelevant. The Fortran 2003 Standard states that "If [the
argument] is of the default character type and the character in position
10 of the ASCII collating sequence is representable in the default
character set, then the result is ACHAR(10). ... If [the argument] is
of the ASCII character type or the ISO 10646 character type, then the
result is CHAR(10,KIND(A))."
Thus, the appropriate result is \n, regardless of what the system uses
as a newline in files.
Unfortunately, this _does_ mean that in a standard-compliant
implementation, the following commands will produce different files on a
system that uses \n\r as a newline -- but that's an issue with the
standard, not with the implementation:
WRITE(*,'A') this // NEW_LINE(this) // that
WRITE(*,'A') this, that