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 24: Line 24:
 
== Alignment ==
 
== Alignment ==
 
{{main|c/alignment of objects|l1=Alignment of objects}}
 
{{main|c/alignment of objects|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 ==
Line 41: Line 41:
  
 
== 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 69: Line 69:
 
== Static assertion ==
 
== Static assertion ==
 
{{main|c/static assertion|l1=Static assertion}}
 
{{main|c/static assertion|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 91: Line 91:
  
 
== 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)