當前位置:柔美女性網 >

綠色生活 >心理 >

c99標準和c11有什麼區別

c99標準和c11有什麼區別

c99標準和c11有什麼區別

C11相比C99的變化

1、對齊處理操作符 alignof,函式 aligned_alloc(),以及 標頭檔案 &ltstdalign.h>。

2、 _Noreturn 函式標記,類似於  gcc 的 __attribute__((noreturn))。

3、_Generic 關鍵詞,有點兒類似於 gcc 的 typeof。

4、靜態斷言( static assertions),_Static_assert(),在解釋 #if 和 #error 之後被處理。

5、 刪除了 gets() 函式,C99中已經將此函式被標記為過時,推薦新的替代函式 gets_s()。

6、 新的 fopen() 模式,(“…x”)。類似 POSIX 中的 O_CREAT|O_EXCL,在檔案鎖中比較常用。

7、 匿名結構體/聯合體,這個早已經在 gcc 中了,我們並不陌生,定義在 p13。

8、 多執行緒支援,包括:_Thread_local,標頭檔案 <threads.h>,裡麵包含執行緒的建立和管理函式(比如 thrd_create(),thrd_exit()),mutex 等等。

9、 _Atomic型別修飾符和 標頭檔案 <stdatomic.h>。

10、 帶邊界檢查(Bounds-checking)的函式介面,定義了新的安全的函式。更多參考 Annex K。

11、 改進的  Unicode 支援,新的標頭檔案 <uchar.h> 等。

12、 新增 quick_exit() 函式,作為第三種終止程式的方式,當 exit() 失敗時可以做最少的清理工作(deinitializition)。

13、 建立複數的巨集, CMPLX()。

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()。

標籤: c11 c99
  • 文章版權屬於文章作者所有,轉載請註明 https://rmnxw.com/zh-tw/lvse/xinli/2x23qo.html