Opened 13 years ago

Closed 13 years ago

#3035 closed Bugs (invalid)

non-standard integral types not fully supported

Reported by: Maxim.Yanchenko@… Owned by: John Maddock
Milestone: Boost 1.40.0 Component: type_traits
Version: Boost 1.39.0 Severity: Problem
Keywords: Cc:

Description

It looks only integral_promotion.hpp and is_integral.hpp are aware of non-standard integral types like __int64, while make_unsigned, is_unsigned, make_signed, and is_signed are not.

Change History (4)

comment:1 by Maxim Yanchenko <Maxim.Yanchenko@…>, 13 years ago

Well, __int64 is a bad example being an exceptional case, I actually meant the whole list of __int8, __int16 etc

comment:2 by nasonov, 13 years ago

I added a TODO to the integral_promotion.hpp some time ago which says "common macro for this #if. Or better yet, PP SEQ of non-standard types."

So, if we define BOOST_TT_AUX_NON_STANDARD_INTS:

#if (defined(BOOST_MSVC) && (BOOST_MSVC < 1300)) \
    || (defined(BOOST_INTEL_CXX_VERSION) && defined(_MSC_VER) && (BOOST_INTEL_CXX_VERSION <= 600)))

# define BOOST_TT_AUX_NON_STANDARD_INTS \
    (__int8) (unsigned __int8)  \
    (__int16)(unsigned __int16) \
    (__int32)(unsigned __int32)

#elif defined(__BORLANDC__) && (__BORLANDC__ == 0x600) && (_MSC_VER < 1300)

# define BOOST_TT_AUX_NON_STANDARD_INTS \
    (__int8) (unsigned __int8)  \
    (__int16)(unsigned __int16) \
    (__int32)(unsigned __int32) \
    (__int64)(unsigned __int64)

#endif

we should be able to change code in is_integral.hpp to something like:

#ifdef BOOST_TT_AUX_NON_STANDARD_INTS
#define BOOST_TT_AUX_DECL(r, data, type) BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(is_integral, type, true)
BOOST_PP_SEQ_FOR_EACH(BOOST_TT_AUX_DECL, _, BOOST_TT_AUX_NON_STANDARD_INTS)
#undef BOOST_TT_AUX_DECL
#endif

and similarly in integral_promotion.hpp:

#ifdef BOOST_TT_AUX_NON_STANDARD_INTS
#define BOOST_TT_AUX_DECL(r, data, type) BOOST_TT_AUX_PROMOTE_NONSTANDARD_TYPE(type)
BOOST_PP_SEQ_FOR_EACH(BOOST_TT_AUX_DECL, _, BOOST_TT_AUX_NON_STANDARD_INTS)
#undef BOOST_TT_AUX_DECL
#endif

It's not as easy for make_signed and make_unsigned but they convert a non-standard type to a corrensponding standard type, e.g. make_unsigned<int8>::type -> unsigned char.

This macro can be also used in tests.

Alex

comment:3 by John Maddock, 13 years ago

A couple of points here:

1) This is only an issue for obsolete MSVC versions that treat int8 etc as distinct types right? 2) I'm fairly sure looking at the code that is_unsigned/is_signed/make_signed/make_unsigned should all support these types already. ie no special code is needed as long as is_integral recognises the type as an integral type. 3) I don't currently have a compiler installed that can test the above :-(

So... can someone please tese the above?

Or if the submitter is unable to confirm this is an issue, I suggest we just close the issue down with an "invalid" tag.

Regards, John.

comment:4 by John Maddock, 13 years ago

Resolution: invalid
Status: newclosed

Closing as invalid: I believe this is a non-issue for all except obsolete compilers.

Note: See TracTickets for help on using tickets.