ifort's no-wrap-margin works only partially

喜你入骨 提交于 2019-12-11 02:52:52

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!