问题
for some unfortunate reasons I have to use ifort, the "problem" is that ifort truncates long (>80 characters) write(*,*) lines by default (this doesn't happen in gfortran). There's an option called -no-wrap-margin that supposedly recovers the gfortran behavior, which is to write lines as long as I want in a single line. However this only works for lines with less than 8184 characters. A line longer than that, as for example the one obtained with
program main
implicit none
integer :: i
write(*,*) (i, i=1, 683)
end program main
results in the last number in the second line of the output. Is there a way to get the behavior I want without specifying a format in the write statement? Have I misunderstood the -no-wrap-margin option?
回答1:
The -no-wrap-margin
option disables the default check in Intel Fortran for the length of output records, which is a remnant from older times.
Unfortunately, however, the Intel implementation seems to impose a limit of around 2^15 (= 32768) bytes of output, or 8192 default (4 byte) integers, forcing the excess to a new line, which gfortran does not, as you observed.
As an upside, Intel has implemented the unlimited format item. Applied to your example code, it could look as follows:
program main
implicit none
integer :: i
write(*,'(*(I0,X))') (i, i=1, 683)
end program main
来源:https://stackoverflow.com/questions/24492202/iforts-no-wrap-margin-works-only-partially