When using COM boolean values are to be passed as VARIANT_BOOL which is declared in wtypes.h as short. There are also predefined values for true and false:
#define VARIANT_TRUE ((VARIANT_BOOL)-1)
#define VARIANT_FALSE ((VARIANT_BOOL)0)
Which is the best way to convert from VARIANT_BOOL to C++ bool
type? Obvious variants are:
compare with VARIANT_FALSE
simply cast to bool
Other ways can be easily invented.
Which is the best way to do this - most readable, most standart-compliant, least prone to accidential bugs planting and least prone to issues with porting to 64-bit platforms?