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]

problem with preprocessed f90 code


Hi all,
I am having an obscure problem. I would like to stringify a macro
argument, e.g.


#define MESSAGE(msg) write(*,*) #msg

program test
 implicit none

 MESSAGE(hello)
end porgram test

if i run
cpp t.F90
I get what I'd expect
program test
 implicit none

 write(*,*) "hello"
end porgram test

however if i compile it directly i get
gfortran t.F90
 In file t.F90:6

 write(*,*) #hello
          1
Error: Expected expression in WRITE statement at (1)
 In file t.F90:7

end porgram test
  1
Error: Expecting END PROGRAM statement at (1)
Error: Unexpected end of file in 't.F90'

any suggestions?
cheers
magi


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