Oracle® Solaris Studio 12.4: C ユーザーガイド

印刷ビューの終了

更新: 2014 年 12 月
 
 

2.9.1 __has_attribute 関数形式のマクロ

事前定義された関数形式のマクロ

__has_attribute(attr)

attr がサポートされる属性の場合、1 に評価されます。それ以外の場合は 0 に評価されます。使用例:

#ifndef __has_attribute // if we don't have __has_attribute, ignore it
    #define __has_attribute(x) 0
#endif
#if __has_attribute(deprecated)
   #define DEPRECATED __attribute__((deprecated))
#else
   #define DEPRECATED // attribute "deprecated" not available
#endif
void DEPRECATED old_func(int); // use the attribute if available