Next: , Up: Integer Properties   [Contents][Index]


13.5.1 Arithmetic Type Properties

TYPE_IS_INTEGER (t) is an arithmetic constant expression that is 1 if the arithmetic type t is an integer type. _Bool counts as an integer type.

TYPE_SIGNED (t) is an arithmetic constant expression that is 1 if the real type t is a signed integer type or a floating type. If t is an integer type, TYPE_SIGNED (t) is an integer constant expression.

EXPR_SIGNED (e) is 1 if the real expression e has a signed integer type or a floating type. If e is an integer constant expression or an arithmetic constant expression, EXPR_SIGNED (e) is likewise. Although e is evaluated, if e is free of side effects then EXPR_SIGNED (e) is typically optimized to a constant.

Example usage:

#include <intprops.h>
#include <time.h>

enum
{
  time_t_is_signed_integer =
    TYPE_IS_INTEGER (time_t) && TYPE_SIGNED (time_t)
};

int
CLOCKS_PER_SEC_is_signed (void)
{
  return EXPR_SIGNED (CLOCKS_PER_SEC);
}