From WikiChip
Editing c/c11

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

This page supports semantic in-text annotations (e.g. "[[Is specified as::World Heritage Site]]") to build structured and queryable content provided by Semantic MediaWiki. For a comprehensive description on how to use annotations or the #ask parser function, please have a look at the getting started, in-text annotation, or inline queries help pages.

Latest revision Your text
Line 1: Line 1:
{{c title|C11}}{{C standards}}
+
{{C standards}}
 
'''C11''' is the latest major revision of the [[C]] standard which was ratified by ISO on December 8, 2011 by the the international standardization working group for the [[C]] programming language, ''ISO/IEC JTC1/SC22/WG14''<ref>[http://www.iso.org/iso/home/store/catalogue_tc/catalogue_detail.htm?csnumber=57853  Information technology -- Programming languages -- C]</ref>. C11 obsoletes the previous standard, C99, published in 1999. In April of 2011 the final draft ([http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf N1570]) was published. The draft passed its final review on October 10, 2011 which was consequently ratified and published as '''ISO/IEC 9899:2011'''. C11 was also later adopted by INCITS as an ANSI standard on May 23, 2012 as '''INCITS/ISO/IEC 9899-2012'''<ref>[http://webstore.ansi.org/RecordDetail.aspx?sku=INCITS%2FISO%2FIEC+9899-2012 INCITS/ISO/IEC 9899-2012]</ref>.
 
'''C11''' is the latest major revision of the [[C]] standard which was ratified by ISO on December 8, 2011 by the the international standardization working group for the [[C]] programming language, ''ISO/IEC JTC1/SC22/WG14''<ref>[http://www.iso.org/iso/home/store/catalogue_tc/catalogue_detail.htm?csnumber=57853  Information technology -- Programming languages -- C]</ref>. C11 obsoletes the previous standard, C99, published in 1999. In April of 2011 the final draft ([http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf N1570]) was published. The draft passed its final review on October 10, 2011 which was consequently ratified and published as '''ISO/IEC 9899:2011'''. C11 was also later adopted by INCITS as an ANSI standard on May 23, 2012 as '''INCITS/ISO/IEC 9899-2012'''<ref>[http://webstore.ansi.org/RecordDetail.aspx?sku=INCITS%2FISO%2FIEC+9899-2012 INCITS/ISO/IEC 9899-2012]</ref>.
  
The C11 standard adds concurrency support, provides a mechanism for {{C|generic selection|type-generic expressions}}, adds alignment-related facilities, {{C|static assertion}}, Unicode support, floating-point characteristic macros, no-return functions, anonymous structures and unions
+
The C11 standard adds concurrency support, provides a mechanism for [[generic selection - C|type-generic expressions]], adds alignment-related facilities, [[static assertion - C|static assertion]], Unicode support, floating-point characteristic macros, no-return functions, anonymous structures and unions
 
, and various bound-checking and reentrancy functions.
 
, and various bound-checking and reentrancy functions.
  
Line 23: Line 23:
  
 
== Alignment ==
 
== Alignment ==
{{main|c/alignment of objects|l1=Alignment of objects}}
+
{{main|Alignment of objects - C|l1=Alignment of objects}}
C11 provides a new mechanism for working with objects alignments. The '''_Alignof''' operator was added which yields the alignment requirement (an  integer constant) of its operand type (which remains unevaluted). A set of convenient macros such as ''alignof'' and ''alignas'' are defined in [[stdalign.h|<stdalign.h>]].
+
C11 provides a new mechanism for working with objects alignments. The '''_Alignof''' operator was added which yields the alignment requirement (an  integer constant) of its operand type (which remains unevaluted). A set of convenient macros such as ''alignof'' and ''alignof'' are defined in [[stdalign.h|<stdalign.h>]].
  
 
For example:
 
For example:
Line 35: Line 35:
  
 
=== Extended alignment ===
 
=== Extended alignment ===
Extended alignment is the ability for an implementation to support alignment requirement greater than _Alignof (max_align_t). A type having extended alignment requirement is called an ''over-aligned type''. That feature is optional and need not be supported.
+
Extended alignment is the ability for an implementation to support alignment requirement greater than _Alignof (max_align_t). A type having extended alignment requirement is called an ''over-aligned type''. That feature is optional and need not be supported.
  
 
== Aligned memory allocations ==
 
== Aligned memory allocations ==
C11 added the {{C|stdlib.h/aligned_alloc|aligned_alloc}} function which allocates space for an object whose alignment is provided by you.
+
C11 added the [[stdlib.h/aligned_alloc - C|aligned_alloc]] function which allocates space for an object whose alignment is provided by you.
  
 
== Unicode support ==
 
== Unicode support ==
C11 adds support for Unicode characters and string literals. A set of prefixes have been added to support [[UTF-8]], [[UTF-16]], and [[UTF-32]] character strings. The ''u8'' prefix for strings creates a UTF-8 encoded string. Likewise the ''u'' and ''U''' prefixes create UTF-16 and UTF-32 strings respectively. For example:
+
C11 adds support for Unicode characters and string literals. A set of prefixes have been added to support [[UTF-8]], [[UTF-16]], and [[UTF-32]] character strings. The ''u8'' prefix for strings creates a UTF-8 encoded string. Likewise the ''u'' and ''U''' prefixes create UTF-16 and UTF-32 strings respectably. For example:
  
 
<source lang="C">
 
<source lang="C">
Line 64: Line 64:
  
 
== Type-generic expressions ==
 
== Type-generic expressions ==
{{main|c/generic selection|l1=Generic selection}}
+
{{main|Generic selection - C|l1=Generic selection}}
 
C11 now provides a mechanism for type-generic expressions, a mechanism needed to perform type-generic math without compiler magic. The feature is achieved via the addition of the new '''_Generic''' keyword.
 
C11 now provides a mechanism for type-generic expressions, a mechanism needed to perform type-generic math without compiler magic. The feature is achieved via the addition of the new '''_Generic''' keyword.
  
 
== Static assertion ==
 
== Static assertion ==
{{main|c/static assertion|l1=Static assertion}}
+
{{main|static assertion - C|l1=Static assertion}}
C11 added support for compile-time assertions. Static assertions are evaluated after the preprocessor compilation phase is over, thereby allowing the use of C operators such as ''sizeof''.
+
C11 added support for compile-time assertions. Static assertions which takes place after the preprocessor compilation phase is over thereby allowing the use of C operators such as ''sizeof''.
  
 
== Bounds-checking interfaces annex (Annex K) ==
 
== Bounds-checking interfaces annex (Annex K) ==
Line 75: Line 75:
  
 
=== Reentrant functions ===
 
=== Reentrant functions ===
The functions ''strtok_s'', ''wcstok_s'', ''bsearch_s'', and ''qsort_s'', were added, which keep track of their state via an argument that is passed instead of a static buffer to ensure they are reentrant.
+
The functions ''strtok_s'', ''wcstok_s'', ''bsearch_s'', and ''qsort_s'', were added which keep track of their state via an argument that is passed instead of a static buffer which would prevent them from being reentrant.
  
 
=== %n format specifier ===
 
=== %n format specifier ===
In various format printing functions, all %specifiers with the exception of %n are used for output purpose. On the other hand, the %n specifier is user for input. The ''_s'' version of the functions was added, which gets rid of the %n specifier entirely.
+
In various format printing functions, all %specifiers with the exception of %n are used for output purpose. On the other hand, the %n specifier is user for input. The ''_s'' version of the functions was added which gets rid of the %n specifier entirely.
  
 
=== memset_s ===
 
=== memset_s ===
The memset_s function is a special version of memset that must execute even if the compiler's optimizer considers it superfluous. The best case for this is when a function attempts to zero-out some confidential information such as a password right before returning, thus making the optimizer think that the memset is not doing anything.
+
The memset_s function is a special version of memset which must execute even if the compiler's optimizer thinks superfluous. The best case for this is when a function attempts to zero-out some confidential information such as a password right before returning thus making the optimizer thinks the memset is not doing anything.
  
 
== Analyzability annex (Annex L) ==
 
== Analyzability annex (Annex L) ==
Line 87: Line 87:
  
 
== Concurrency ==
 
== Concurrency ==
{{main|c/concurrency|l1=Concurrency}}
+
{{main|Concurrency - C|l1=Concurrency}}
C11's largest addition to the C programming language, is the addition of semantics of multi‐threaded programs. The standard also added a facility for performing inter‐thread communication via atomic variables as well as thread-specific storage. Thread support is optional and must be tested for via the  '''__STDC_NO_THREADS__''' macro.
+
C11's largest addition to the C programming language is the addition of semantics of a multi‐threaded programs. The standard also added a facility for performing inter‐thread communication via atomic variables as well as thread-specific storage. Thread support is optional and must be tested for via the  '''__STDC_NO_THREADS__''' macro.
  
 
== Compiler support ==
 
== Compiler support ==
 +
Due to its relative new status; most compilers have a lot implemented but none are complete.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 100: Line 101:
 
| ACK || style="background:#FF6666;text-align:center;" | No Support || ||
 
| ACK || style="background:#FF6666;text-align:center;" | No Support || ||
 
|-
 
|-
| Clang || style="background:#99FF66;text-align:center;" | Supported || style="text-align:center;" | -std=c11 || No support for (optional) <threads.h>
+
| Clang || style="background:#FFCC66;text-align:center;" | Partial || style="text-align:center;" | -std=c11 || No thread support
 
|-
 
|-
| GCC || style="background:#99FF66;text-align:center;" | Supported || style="text-align:center;" | -std=c11<ref>[http://gcc.gnu.org/onlinedocs/gcc/C-Dialect-Options.html Options Controlling C Dialect]</ref> || No support for (optional) <threads.h><ref>[http://gcc.gnu.org/wiki/C11Status C11 Status]</ref>
+
| GCC || style="background:#FFCC66;text-align:center;" | Partial || style="text-align:center;" | -std=c11<ref>[http://gcc.gnu.org/onlinedocs/gcc/C-Dialect-Options.html Options Controlling C Dialect]</ref> || Missing thread, Unicode support<ref>[http://gcc.gnu.org/wiki/C11Status C11 Status]</ref>
 
|-
 
|-
| TCC || style="background:#FFCC66;text-align:center;" | Partial || ||  
+
| TCC || style="background:#FF6666;text-align:center;" | No Support || ||  
 
|-
 
|-
 
| ICC || style="background:#FFCC66;text-align:center;" | Partial || style="text-align:center;" | ||
 
| ICC || style="background:#FFCC66;text-align:center;" | Partial || style="text-align:center;" | ||

Please note that all contributions to WikiChip may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see WikiChip:Copyrights for details). Do not submit copyrighted work without permission!

Cancel | Editing help (opens in new window)