It is well known that both C++ takes features from C but that C also standardizes C++ features. C1x has gained full expression temporaries (previously it only had sequence point temporaries). C1x also took from the C++11 threading effort.
I wonder what other features C1x took from C++?
Some similarities include:
_Static_assert ( constant-expression , string-literal );
char16_t
=uint_least16_t
), literals, and utilities._Generic
_Generic
is really more like overloading than what we have with the power of templates. The ubiquitous example of _Generic
is:
#define cbrt(X) _Generic((X), long double: cbrtl, \
default: cbrt, \
float: cbrtf)(X)
..but I'm not sure which were inherited expressly from C++.
The threading part of C1x (5.1.2.4) is taken almost literally from C++11. Terms like "conflict" and "atomic operations" have identical definitions, for all practical purposes.
Alignment is also inspired by C++11: the keyword is alignof
, and the maximum aligned type is max_align_t
(dropping the std::
namespace, of course).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With