首页 相关文章 gcc支持在#pragma语句中使用宏替换吗

gcc支持在#pragma语句中使用宏替换吗


  问题:
  gcc编译器似乎对宏编译指令不支持宏替换,比如:
   #define PACK1 pack(1)
   #pragma PACK1
  
  
  回答:
  gcc 不支持#pragma行上的宏替换,参见:
  
  info gcc
  5.25 Declaring Attributes of Functions
  ...
   Some people object to the `__attribute__' feature, suggesting that
  ISO C's `#pragma' should be used instead. At the time `__attribute__'
  was designed, there were two reasons for not doing this.
  
   1. It is impossible to generate `#pragma' commands from a macro.
  
   2. There ...[ 查看全文 ]

2016-02-19 标签:

gcc支持在#pragma语句中使用宏替换吗的相关文章

手机页面
收藏网站 回到头部