c++ - Can cstdint typedefs bind to some implementation specific types std::numeric_limits is not specialized for? -


is possible, @ least theoretically, cstdint typedefs bind implementation specific types std::numeric_limits not specialized for?

according http://www.cplusplus.com/reference/limits/numeric_limits , let me quote, "[std::numeric_limits] specialized every fundamental arithmetic type, members describing properties of type t. template shall not specialized other type."

according http://en.cppreference.com/w/cpp/types/numeric_limits , let me quote again, "implementations may provide specializations of std::numeric_limits implementation-specific types".

"may", cppreference says. don't have to.

and finally, according http://www.cplusplus.com/reference/cstdint , typedefs defined in header "are typedefs of fundamental integral types or extended integral types".

so, sum - seems cstdint typedefs might bind extended integral types (whatever are), not fundamental integral types (again, whatever are), , therefore might incompatible std::numeric_limits . correct?

however, documentations linked seem inconsistent on 1 point. isn't cplusplus.com's prohibition std::numeric_limits must not specialized non-fundamental arithmetic type in opposition of cppreference's allowance std::numeric_limits might specialized implementation-specific types? unless, of course, these implementation-specific types are fundamental integral types, in case, hopefully, std::numeric_limits have specialized cstdint typedefs.

the documentations confuse me. ask question here :)

edit.

according http://eel.is/c++draft/cstdint , cstdint must bind integer types. , according http://eel.is/c++draft/limits.numeric , "specializations shall provided each arithmetic type, both floating point , integer, including bool". understanding integer type arithmetic type , therefore std::numeric_limits must specialized cstdint typedefs correct?

the specializations such std::numeric_limits<std::int_fast32_t> must exist.

3.9.1/2:

there 5 standard signed integer types: "signed char", "short int", "int", "long int", , "long long int". ... there may implementation-defined extended signed integer types. standard , extended signed integer types collectively called signed integer types.

3.9.1/3:

for each of standard signed integer types, there exists corresponding (but different) standard unsigned integer type.... likewise, each of extended signed integer types there exists corresponding extended unsigned integer type.... standard , extended unsigned integer types collectively called unsigned integer types.

3.9.1/7:

types bool, char, char16_t, char32_t, wchar_t, , signed , unsigned integer types collectively called integral types. synonym integral type integer type.

3.9.1/8:

integral , floating types collectively called arithmetic types. specializations of standard template std::numeric_limits (18.3) shall specify maximum , minimum values of each arithmetic type implementation.

18.3.2.1/2:

specializations [of numeric_limits] shall provided each arithmetic type, both floating point , integer, including bool.

18.4.1:

namespace std {   typedef signed_integer_type int8_t;    // optional   //...   typedef unsigned_integer_type uint8_t; // optional   //... } 

so types defined in <cstdint> might extended types, integer types , therefore must have corresponding specializations of std::numeric_limits.

also, integral types "fundamental" in sense used in standard (3.9), though not standard types.


Comments