如何让prepropressor cpp在fortran函数名中扩展宏

时间:2014-06-05 14:07:33

标签: fortran preprocessor

我在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

0 个答案:

没有答案