Parenthesis and goup write.
Benjamin Réveillé
benjamin.reveille@gmail.com
Tue Dec 6 09:40:00 GMT 2005
Hello again
Here is another sample program:
program group
implicit none
integer, parameter :: nb=2
integer :: n
real(kind(0.d0)), dimension(nb) :: angi, angf
do n=1,nb
angi(n)=-dble(n)
angf(n)=dble(n)
end do
write(*,'(e12.5,1x,e12.5)') ((angi(n),angf(n)),n=1,nb)
end program group
This compiles fine with intel 8.1, pgi 5.1, ibm xlf, sgi mipspro 7
but gfortran issues:
In file group.f90:12
write(*,'(e12.5,1x,e12.5)') ((angi(n),angf(n)),n=1,nb)
1
Error: Expected a right parenthesis in expression at (1)
If I change the write statement to
write(*,'(e12.5,1x,e12.5)') (angi(n),angf(n),n=1,nb)
Then it compiles and runs fine. I usualy add the extra parenthesis so
as to make very clear that the 2 arrays are iterated on. I agree it
may not be useful, but I did not expect it to be incorrect. Does
someone have an explanation.
If the standard forbids it I'll get rid of a "bad" habit, if not I
guess it's a gfortran bug.
Thanks
Benjamin
More information about the Fortran
mailing list