This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Is this code legal


Dominique Dhumieres schrieb:
> Is the following code legal:
>
> integer i
> i = 1
> print ('(z20.8)'), i
> end
I'm not completely sure, but I think it is valid. The problem are the
parentheses around '(z20.8)' as gfortran does not permit them.
In the Fortran 2003 standard, one finds in Section 9.5 and 9.5.1.1:

R911  write-stmt   is  WRITE (io-control-spec-list) [output-item list]
R912  print-stmt   is  PRINT format[, output-item-list]

where "format" is:

R914  format       is  default-char-expr
                   or  label
                   or  *

The () are thus not mandatory, but the might be part of the
default-char-expr.

Actually, gfortran happily accepts the parentheses in expressions like:
character(len=*), parameter :: foo = ('bar')
print *, ('hello')


Tobias


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]