problem with preprocessed f90 code

Tobias Burnus burnus@net-b.de
Tue Aug 8 12:34:00 GMT 2006


Hi all,

Magnus Hagdorn schrieb:
> #define MESSAGE(msg) write(*,*) #msg

> if i run
> cpp t.F90
> I get what I'd expect

> however if i compile it directly i get
> gfortran t.F90
>  write(*,*) #hello

> any suggestions?

I don't have any suggestion, but the reason is that gfortran calls cpp
with the option "-traditional-cpp". In that case cpp writes:
   write(*,*) #hello

g95 and NAG f95 do the same (i.e. produce an error) whereas the Intel
and the Sun Fortran Compiler produce the expected "hello".

Tobias



More information about the Fortran mailing list