Let's assume I have a macro like this:
#define IS_SIGNED_B(T) (static_cast<T>(-1)<0)
Would it be alright to write it as
#define IS_SIGNED_B(T) (T(-1)<0)
Knowing that T is (should) always be a fundamental type. And various other cases where I need a certain value to be explicitly of a certain type.
I know this can cause issues for situations like:
signed char(0);
But knowing that I have fundamental types typedef'ed as:
typedef signed char Int8;
Int8(0);
Are there any other issues other than this? Can the constructor of a fundamental type be considered identical to a static cast?
EDIT: I know about the existence of std::numeric_limits
and std::is_signed
. This was just an example. Not the actual case. My apologies for not mentioning that.