C语言标准C11
2016-01-17 16:57
459 查看
相比C99的变化
1. 对齐处理操作符 alignof,函数 aligned_alloc(),以及 头文件 。见 7.15 节。
2. _Noreturn 函数标记,类似于 gcc 的 __attribute__((noreturn))。例子:
_Noreturn void thrd_exit(int res);
3. _Generic 关键词,有点儿类似于 gcc 的 typeof。例子:
#define cbrt(X) _Generic((X), long double: cbrtl, \
default: cbrt, \
float: cbrtf)(X)
4. 静态断言( static assertions),_Static_assert(),在解释 #if 和 #error
之后被处理。例子:
_Static_assert(FOO > 0, "FOO has a wrong value");
5. 删除了 gets() 函数,C99中已经将此函数被标记为过时,推荐新的替代函数 gets_s()。
6. 新的 fopen() 模式,(“…x”)。类似 POSIX 中的 O_CREAT|O_EXCL,在文件锁中比较常用。
7. 匿名结构体/联合体,这个早已经在 gcc 中了,我们并不陌生,定义在 6.7.2.1 p13。
8. 多线程支持,包括:_Thread_local,头文件 ,里面包含线程的创建和管理函数(比如
thrd_create(),thrd_exit()),mutex (比如
mtx_lock(),mtx_unlock())等等,更多内容清参考 7.26 节。
9. _Atomic类型修饰符和 头文件 ,见 7.17 节。
10. 带边界检查(Bounds-checking)的函数接口,定义了新的安全的函数,例如 fopen_s(),strcat_s()
等等。更多参考 Annex K。
11. 改进的 Unicode 支持,新的头文件 等。
12. 新增 quick_exit() 函数,作为第三种终止程序的方式,当 exit()
失败时可以做最少的清理工作(deinitializition),具体见 7.22.4.7。
13. 创建复数的宏, CMPLX(),见 7.3.9.3。
14. 更多浮点数处理的宏 (More macros for querying the characteristics of
floating point types, concerning subnormal floating point numbers
and the number of decimal digits the type is able to store)。
15. struct timespec 成为 time.h 的一部分,以及宏 TIME_UTC,函数
timespec_get()。
1. 对齐处理操作符 alignof,函数 aligned_alloc(),以及 头文件 。见 7.15 节。
2. _Noreturn 函数标记,类似于 gcc 的 __attribute__((noreturn))。例子:
_Noreturn void thrd_exit(int res);
3. _Generic 关键词,有点儿类似于 gcc 的 typeof。例子:
#define cbrt(X) _Generic((X), long double: cbrtl, \
default: cbrt, \
float: cbrtf)(X)
4. 静态断言( static assertions),_Static_assert(),在解释 #if 和 #error
之后被处理。例子:
_Static_assert(FOO > 0, "FOO has a wrong value");
5. 删除了 gets() 函数,C99中已经将此函数被标记为过时,推荐新的替代函数 gets_s()。
6. 新的 fopen() 模式,(“…x”)。类似 POSIX 中的 O_CREAT|O_EXCL,在文件锁中比较常用。
7. 匿名结构体/联合体,这个早已经在 gcc 中了,我们并不陌生,定义在 6.7.2.1 p13。
8. 多线程支持,包括:_Thread_local,头文件 ,里面包含线程的创建和管理函数(比如
thrd_create(),thrd_exit()),mutex (比如
mtx_lock(),mtx_unlock())等等,更多内容清参考 7.26 节。
9. _Atomic类型修饰符和 头文件 ,见 7.17 节。
10. 带边界检查(Bounds-checking)的函数接口,定义了新的安全的函数,例如 fopen_s(),strcat_s()
等等。更多参考 Annex K。
11. 改进的 Unicode 支持,新的头文件 等。
12. 新增 quick_exit() 函数,作为第三种终止程序的方式,当 exit()
失败时可以做最少的清理工作(deinitializition),具体见 7.22.4.7。
13. 创建复数的宏, CMPLX(),见 7.3.9.3。
14. 更多浮点数处理的宏 (More macros for querying the characteristics of
floating point types, concerning subnormal floating point numbers
and the number of decimal digits the type is able to store)。
15. struct timespec 成为 time.h 的一部分,以及宏 TIME_UTC,函数
timespec_get()。
相关文章推荐
- C语言中的隐式函数声明
- C语言栈
- 一起talk C栗子吧(第一百零五回:C语言实例--生产者与消费者问题一)
- C语言的指针大小问题
- 【C/C++】结构体和联合体的区别
- 基于一致性hash算法 C++语言的实现详解
- C#与C++区别(转)
- C语言中 v...printf类函数的用法
- c++中使用new动态分配存储空间
- C++操作文本
- 《C语言及程序设计初步》第36讲实践项目
- C++实现 复数类
- 详解C指针
- C++:模板与泛型编程
- 在RHEL上安装Thrift(支持C++)的若干问题
- c/c++ 文件操作相关的常用函数
- C语言实现银行家算法
- C语言的atan()和atan2()函数
- C++小题(十五)
- C语言-纸牌计算24点小游戏