Compatibility with non-GNU compilers
来源:互联网 发布:在淘宝上怎么退货退款 编辑:程序博客网 时间:2024/05/16 13:57
Fortunately, the __attribute__ mechanism was cleverly designed in a way to make it easy to quietly eliminate them if used on platforms other than GNU C. Superficially,__attribute__ appears to have multiple parameters (which would typically rule out using a macro), but thetwo sets of parentheses effectively make it a single parameter, and in practice this works very nicely.
/* If we're not using GNU C, elide __attribute__ */#ifndef __GNUC__# define __attribute__(x) /*NOTHING*/#endif
Note that __attribute__ applies to function declarations, notdefinitions, and we're not sure why this is. So when defining a function that merits this treatment, an extra declaration must be used (in the same file):
/* <em>function declaration</em> */void die(const char *format, ...) <strong>__attribute__((noreturn)) __attribute__((format(printf,1,2)))</strong>;void die(const char *format, ...){/* <em>function definition</em> */}
0 0
- Compatibility with non-GNU compilers
- GNU compilers
- winform compatibility with IE8
- compilers
- Building NetCDF* with the Intel® Compilers
- Website Design With Standards For Browser Compatibility
- Policies/Binary Compatibility Issues With C++
- Policies/Binary Compatibility Issues With C++
- Policies/Binary Compatibility Issues With C++
- Compilers: Principles for C/C++ with .c & .h
- Programming with GNU Readline
- Play with GNU Screen
- error: Berkeley DB with 1.85 compatibility not found
- A WebLogic Server 12.1.3 Compatibility with Previous Releases
- Creating Apps With Material Design —— Maintaining Compatibility
- JRE not compatible with project .class file compatibility: 1.7
- android-Building Apps for Work,Ensuring Compatibility with Managed Profiles
- Managing Projects with GNU Make
- 关于获取text类型value的一个小问题
- NYOJ 769 乘数密码 (字符串)
- Python脚本10 —— 复制json文件并替换指定字段
- ElasticSearch的虚拟机VM配置
- AVFoundation视频相关参数
- Compatibility with non-GNU compilers
- 布洛芬
- Josephus
- PXE启动芯片出错代码表初始化/引导/载入Bootstrap错误代码
- JAVA中的Random()函数
- handler 类型在转换异常
- Linux无线网络操作相关命令
- Hibernate的List映射
- Android数据库操作通用化