Difference between revisions of "Programming Stream C11 C++11"
(Created page with ' Agreed Detail Changes to OOP344/BTP300 OOP344/BTP300 – C++ Part new - add to align with C++11 types - specification and qualification trivial - redefinition of char …') |
|||
Line 1: | Line 1: | ||
− | |||
Agreed Detail Changes to OOP344/BTP300 | Agreed Detail Changes to OOP344/BTP300 | ||
− | + | == C++ Part == | |
− | new | + | * new - add to align with C++11 |
− | types - | + | ** types - specification and qualification |
− | trivial | + | ::: trivial - redefinition of char modified to be the size necessary to store 8-bit coding of UTF-8 and basic execution character set |
− | wchar_t, | + | wchar_t, char16_t, char32_t – Unicode support for UTF-16 and UTF-32 |
− | trivial | + | ::: trivial - constexpr – function or object constructor is a compile-time constant – qualifier on types other than int enum |
− | trivial - decltype() deduces the type of the expression at compile time | + | ::: trivial - decltype() deduces the type of the expression at compile time |
− | trivial - enum forward declarations admissible as long as the size is specified | + | ::: trivial - enum forward declarations admissible as long as the size is specified |
− | using syntax alternative for typedef – using OtherType = ... ; | + | ::: using syntax alternative for typedef – using OtherType = ... ; |
− | trivial - thread_local storage duration – variable unique to the thread | + | ::: trivial - thread_local storage duration – variable unique to the thread |
− | expressions | + | ** expressions |
− | trivial - sizeof() works on members of uninstantiated classes | + | ::: trivial - sizeof() works on members of uninstantiated classes |
− | trivial - L' ' and L” “ - prefix for wide character | + | ::: trivial - L' ' and L” “ - prefix for wide character |
− | trivial - codepoint constants defined using \u \U | + | ::: trivial - codepoint constants defined using \u \U |
− | string literals defined using prefixes u8” ” u” ” and U” ” | + | ::: string literals defined using prefixes u8” ” u” ” and U” ” |
− | trivial - R” “ raw string literal avoids escaping strings manually cf. XML files, scripts, regex | + | ::: trivial - R” “ raw string literal avoids escaping strings manually cf. XML files, scripts, regex |
− | trivial - R can be combined with wide-character literal or Unicode prefixes | + | ::: trivial - R can be combined with wide-character literal or Unicode prefixes |
− | functions | + | ** functions |
− | anonymous (lambda) functions [](int x){ return x + 2; } - return type is implicit as long as all expressions return the same type | + | ::: anonymous (lambda) functions [](int x){ return x + 2; } - return type is implicit as long as all expressions return the same type |
− | alternate trailing-return-type function syntax auto foo(int a, int b) -> decltype(a + b) { return a + b; } | + | ::: alternate trailing-return-type function syntax auto foo(int a, int b) -> decltype(a + b) { return a + b; } |
− | encapsulation | + | ** encapsulation |
− | constexpr ctor – contains only constant expression | + | ::: constexpr ctor – contains only constant expression |
− | rvalues – modifiable temporaries – T&& – to avoid deep copies on pass/return by value - move constructor T::T(T&&) copies pointer out of rvalue into new temp and sets rvalue pointer to nullptr – move assignment operator T& T::operator=(T&&) | + | ::: rvalues – modifiable temporaries – T&& – to avoid deep copies on pass/return by value - move constructor T::T(T&&) copies pointer out of rvalue into new temp and sets rvalue pointer to nullptr – move assignment operator T& T::operator=(T&&) |
− | trivial - delegated construction allows default value to be changed without recompilation of application code (e.g. SomeType() : SomeType(42)) | + | ::: trivial - delegated construction allows default value to be changed without recompilation of application code (e.g. SomeType() : SomeType(42)) |
− | trivial - SomeType() = default explicit default | + | ::: trivial - SomeType() = default explicit default |
− | trivial - explicit conversion operators – keyword can be applied here also | + | ::: trivial - explicit conversion operators – keyword can be applied here also |
− | trivial - less restrictions on members of a union | + | ::: trivial - less restrictions on members of a union |
− | inheritance | + | ** inheritance |
− | trivial - inherited constructors – using BaseClass::BaseClass | + | ::: trivial - inherited constructors – using BaseClass::BaseClass |
− | trivial - override identifier of base class virtual function | + | ::: trivial - override identifier of base class virtual function |
− | trivial - final identifier – prevent further overrides | + | ::: trivial - final identifier – prevent further overrides |
− | polymorphism - fuller generic programming support - templates | + | ** polymorphism - fuller generic programming support - templates |
− | trivial - extern template – do not instantiate template in this translation unit | + | ::: trivial - extern template – do not instantiate template in this translation unit |
− | trivial - right angle bracket closes the template where it is reasonable | + | ::: trivial - right angle bracket closes the template where it is reasonable |
− | using syntax for typedef – cf. Template aliases | + | ::: using syntax for typedef – cf. Template aliases |
− | trivial - variadic templates just extends variadic syntax to templates | + | ::: trivial - variadic templates just extends variadic syntax to templates |
− | trailing return type function syntax auto foo(const T& a, const T& b) -> decltype(a + b) { return a + b; } - return type is unknown for template type T | + | ::: trailing return type function syntax auto foo(const T& a, const T& b) -> decltype(a + b) { return a + b; } - return type is unknown for template type T |
− | trivial - static_assert(,) for templates | + | ::: trivial - static_assert(,) for templates |
− | library | + | ** library |
− | initializer lists – extends from POD cases to all classes including std containers - initialization-list constructor – T::T(std::initializer_list<type> list) – initializer list is constant and the data in its members cannot be changed | + | ::: initializer lists – extends from POD cases to all classes including std containers - initialization-list constructor – T::T(std::initializer_list<type> list) – initializer list is constant and the data in its members cannot be changed |
− | multi-threading support | + | ::: multi-threading support |
− | other features | + | ** other features |
− | uniform initialization – uses initializer-list syntax – aggregate initialization, constructor, return list without explicit type | + | ::: uniform initialization – uses initializer-list syntax – aggregate initialization, constructor, return list without explicit type |
− | trivial - static_assert(,) – tests assertion at compile-time | + | ::: trivial - static_assert(,) – tests assertion at compile-time |
− | + | * C Part | |
− | extend existing pre-defined macros to align with C11 | + | :: extend existing pre-defined macros to align with C11 |
− | pre-defined macros to identify installed features __STDC_*__ | + | :: pre-defined macros to identify installed features __STDC_*__ |
− | trivial - currently covered in C++ part - add to align with C99 | + | :: trivial - currently covered in C++ part - add to align with C99 |
− | inline functions | + | :: inline functions |
− | anonymous structures and unions | + | :: anonymous structures and unions |
− | new - add to align with C99 and C++11 | + | ** new - add to align with C99 and C++11 |
− | bool macro, _Bool data type (C99) | + | ::: bool macro, _Bool data type (C99) |
− | variadic macros | + | ::: variadic macros |
− | Unicode support – same as C++ | + | ::: Unicode support – same as C++ |
− | static assertions – evaluated later than #if and #error | + | ::: static assertions – evaluated later than #if and #error |
− | bounds-checking – list of safe alternative library functions for robust programming | + | ::: bounds-checking – list of safe alternative library functions for robust programming |
− | multi-threading support | + | ::: multi-threading support |
Revision as of 10:26, 3 May 2012
Agreed Detail Changes to OOP344/BTP300
C++ Part
- new - add to align with C++11
- types - specification and qualification
- trivial - redefinition of char modified to be the size necessary to store 8-bit coding of UTF-8 and basic execution character set
wchar_t, char16_t, char32_t – Unicode support for UTF-16 and UTF-32
- trivial - constexpr – function or object constructor is a compile-time constant – qualifier on types other than int enum
- trivial - decltype() deduces the type of the expression at compile time
- trivial - enum forward declarations admissible as long as the size is specified
- using syntax alternative for typedef – using OtherType = ... ;
- trivial - thread_local storage duration – variable unique to the thread
- expressions
- trivial - sizeof() works on members of uninstantiated classes
- trivial - L' ' and L” “ - prefix for wide character
- trivial - codepoint constants defined using \u \U
- string literals defined using prefixes u8” ” u” ” and U” ”
- trivial - R” “ raw string literal avoids escaping strings manually cf. XML files, scripts, regex
- trivial - R can be combined with wide-character literal or Unicode prefixes
- functions
- anonymous (lambda) functions [](int x){ return x + 2; } - return type is implicit as long as all expressions return the same type
- alternate trailing-return-type function syntax auto foo(int a, int b) -> decltype(a + b) { return a + b; }
- encapsulation
- constexpr ctor – contains only constant expression
- rvalues – modifiable temporaries – T&& – to avoid deep copies on pass/return by value - move constructor T::T(T&&) copies pointer out of rvalue into new temp and sets rvalue pointer to nullptr – move assignment operator T& T::operator=(T&&)
- trivial - delegated construction allows default value to be changed without recompilation of application code (e.g. SomeType() : SomeType(42))
- trivial - SomeType() = default explicit default
- trivial - explicit conversion operators – keyword can be applied here also
- trivial - less restrictions on members of a union
- inheritance
- trivial - inherited constructors – using BaseClass::BaseClass
- trivial - override identifier of base class virtual function
- trivial - final identifier – prevent further overrides
- polymorphism - fuller generic programming support - templates
- trivial - extern template – do not instantiate template in this translation unit
- trivial - right angle bracket closes the template where it is reasonable
- using syntax for typedef – cf. Template aliases
- trivial - variadic templates just extends variadic syntax to templates
- trailing return type function syntax auto foo(const T& a, const T& b) -> decltype(a + b) { return a + b; } - return type is unknown for template type T
- trivial - static_assert(,) for templates
- library
- initializer lists – extends from POD cases to all classes including std containers - initialization-list constructor – T::T(std::initializer_list<type> list) – initializer list is constant and the data in its members cannot be changed
- multi-threading support
- other features
- uniform initialization – uses initializer-list syntax – aggregate initialization, constructor, return list without explicit type
- trivial - static_assert(,) – tests assertion at compile-time
- C Part
- extend existing pre-defined macros to align with C11
- pre-defined macros to identify installed features __STDC_*__
- trivial - currently covered in C++ part - add to align with C99
- inline functions
- anonymous structures and unions
- new - add to align with C99 and C++11
- bool macro, _Bool data type (C99)
- variadic macros
- Unicode support – same as C++
- static assertions – evaluated later than #if and #error
- bounds-checking – list of safe alternative library functions for robust programming
- multi-threading support