我在Fortran文件上使用cpp预处理器时遇到了一个非常简单的问题:为什么以下代码中的MACRO
未在子例程名fooMACRO
中展开(但它在其他地方)?
#define MACRO 'bye'
#define MSG 'hello world'
subroutine fooMACRO()
print*, MACRO
end subrountine
program hello
print*, MSG
call fooMACRO()
end program
它给出了
$ gfortran-E helloworld.F
# 1 "helloworld.F"
# 1 "<command-line>"
# 1 "helloworld.F"
subroutine fooMACRO()
print*, 'bye'
end subrountine
program hello
print*, 'hello world'
call fooMACRO()
end program