Chinaunix首页 | 论坛 | 博客
  • 博客访问: 477603
  • 博文数量: 72
  • 博客积分: 1851
  • 博客等级: 上尉
  • 技术积分: 1464
  • 用 户 组: 普通用户
  • 注册时间: 2010-09-16 17:50
文章分类

全部博文(72)

文章存档

2013年(1)

2012年(17)

2011年(51)

2010年(3)

分类: C/C++

2011-12-06 11:24:40

1.API过时后,抛出的警告宏:

__THROW __attribute_deprecated__

__THROW__宏定义如下:

  1. </usr/include/argp.h>
  2. #ifndef __THROW
  3.   #define __THROW
  4. #endif

  5. #ifndef __THROW
  6.   #ifndef __GNUC_PREREQ
  7.      #define __GNUC_PREREQ(maj,min) (0)
  8.   #endif
  9. #if defined __cplusplus && __GNUC_PREREQ(2,8)
  10.   #define __THROW     throw()
  11. #else
  12.   #define __THROW
  13. #endif
  14. #endif

从上面的定义可以看出,THROW宏在C语言中为空,现在来看__attribute_deprecated__宏定义:

  1. </usr/include/sys/cdefs.h>
  2. #if __GNU_PREREQ (3,2)
  3. #define __attribute_deprecated__ __attribute__((__deprecated__))
  4. #else
  5. #define __attribute_deprecated__
  6. #endif

  7. </usr/include/argp.h>
  8. #ifndef __attribute__
  9. #if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT__ANSI__
  10. #define __attribute__(Spec)
  11. #endif

__attribute__,__deprecated__gcc的一个

更多的gcc有用扩展见:http://www.ibm.com/developerworks/linux/library/l-gcc-hacks/

阅读(2640) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~