P99

◆ P99_ISSIGNED

#define P99_ISSIGNED (   T)    (P99_M1(T) < P99_1(T))

Determine if T is an unsigned or signed integral type.

This works as follows:

  • If T is signed then -1 in that type is always less than 0 in that type
  • If T is unsigned then conversion of -1 to that type gives the maximally encodable value for that type. This is always greater than 0 in that type,
  • If T is _Bool or equivalent, -1 converted to it results in 1 and 0 is also mapped to 0. Thus it is detected as unsigned.
See also
P99_SIGNED for a similar macro that takes an expression as an argument
Remarks
argument 0 should correspond to a type that is not a VLA.

Definition at line 423 of file p99_int.h.