Previous C++ standard is C++03 (2003); previous C std is C99.They are not released together, but they did this time as a combo of C11 and C++11.
__STDC_VERSION__ == 201112L
C11 (formerly C1X) is an informal name for ISO/IEC 9899:2011 (see wiki)
http://en.wikipedia.org/wiki/C11_%28C_standard_revision%29
————————–
Changes from C99
The standard includes several changes to the C99 language and library specifications, such as:[8]
- Alignment specification (
_Alignas
specifier,alignof
operator,aligned_alloc
function,<stdalign.h>
header file) - The
_Noreturn
function specifier - Type-generic expressions using the
_Generic
keyword. For example, the following macrocbrt(x)
translates tocbrtl(x)
,cbrt(x)
orcbrtf(x)
depending on the type ofx
:
#define cbrt(X) _Generic((X), long double: cbrtl, \ default: cbrt, \ float: cbrtf)(X)
- Multithreading support (
_Thread_local
storage-class specifier,<threads.h>
header including thread creation/management functions, mutex, condition variable and thread-specific storage functionality, as well as the_Atomic
type qualifier and<stdatomic.h>
for uninterruptible object access). - Improved Unicode support based on the C Unicode Technical Report ISO/IEC TR 19769:2004 (
char16_t
andchar32_t
types for storing UTF-16/UTF-32 encoded data, including conversion functions in<uchar.h>
and the correspondingu
andU
string literal prefixes, as well as theu8
prefix for UTF-8 encoded literals).[9] - Removal of the
gets()
function, deprecated in the previous C language standard revision, ISO/IEC 9899:1999/Cor.3:2007(E), in favor of a new safe alternative,gets_s
. - Bounds-checking interfaces (Annex K).[10]
- Analyzability features (Annex L).
- 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.
- Anonymous structures and unions, useful when unions and structures are nested, e.g. in
struct T { int tag; union { float x; int n; }; };
. - Static assertions, which are evaluated during translation at a later phase than
#if
and#error
, when types are understood by the translator. - An exclusive create-and-open mode (
"…x"
) for fopen. This behaves likeO_CREAT|O_EXCL
in POSIX, which is commonly used for lock files. - The
quick_exit
function as a third way to terminate a program, intended to do at least minimal deinitialization if termination withexit
fails.[11] - Macros for the construction of complex values (partly because
real + imaginary*I
might not yield the expected value ifimaginary
is infinite or NaN).[12]
—————————
There is little new features compared with C99, that is why it is less reported than C++11.
C99, new features including:
- Variable length arrays
- Designated initializers
- Type-generic math library
- New datatypes: long long, _Complex, _Bool
- restrict pointers
- Intermingled declarations of variables
- Inline functions
- One-line comments that begin with //
Introduction of new features of C11 can be found here:
http://blog.smartbear.com/software-quality/bid/173187/C11-A-New-C-Standard-Aiming-at-Safer-Programming
=====================================
GCC 4.7 is a milestone for C++11 and C11 support, you can use
gcc -std=c11
g++ -std=c++11
C11 support status by GNU GCC can be found here.
http://gcc.gnu.org/wiki/C11Status
===================================
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <stddef.h> //size_t
#include <locale.h>
#include <limits.h> // double is not supported
#include <float.h> // isnan() isinf()
// for a full list of std c headers:
// C99
#include <stdarg.h> //va_list
#include <stdinttypes.h>
#include <complex.h> //complex number
#include <tgmath.h> //type generic math
#include <fenv.h> // float exception
//C99 adopted into C++11
#include <stdbool.h> // standarization into C++11
#include <stdint.h> // standarization into C++11
#include <wctype.h>
//new headers from C11
//#include <uchar.h> // not supported yet by mingw32 4.7
//#include <stdatomic.h>
//#include <stdalign.h>
//#include <stdnoreturn.h>
//#include <threads.h>
CC-BY-NC 4.0 licensed free for non-commercial usage
Author: Qingfeng XIA
copyright (C) 2011-2020
http://www.iesensor.com
please keep the original link in your reference.
http://www.iesensor.com/blog/2013/03/23/you-must-know-c11-but-have-you-noticed-c11/