Opened 6 years ago

#12504 new Feature Requests

Use types from <cinttypes> in boost::uint_t and boost::int_t

Reported by: john@… Owned by: Daryle Walker
Milestone: To Be Determined Component: integer
Version: Boost 1.61.0 Severity: Problem
Keywords: Cc:

Description

I'd like to suggest that instead of using built-in types to implement boost::uint_t and boost::int_t that the explicitly sized types from <cinttypes> be used.

Take for instance this definition:

template<> struct int_least_helper<4> { typedef short least; };

Is there any reason not to replace short with std::int16_t in this line?

My (entirely selfish) reason to suggesting this is that I've hit an odd case in code I am writing in which boost::uint_t<64>::fast is a different type to std::uint64_t. It would appear that std::uint64_t is defined as unsigned long long under XCode 7 but unsigned long under XCode 6. I fear that weirdness like this is inevitable given the many combinations of widths which built-in integer types can assume. But using the known-width types provided by <cinttypes> would seem like a more reliable way to proceed.

Many thanks, John McFarlane

Change History (0)

Note: See TracTickets for help on using tickets.