Function Macro

GLibSTATIC_ASSERT_EXPR

since: 2.30

Declaration [src]

#define G_STATIC_ASSERT_EXPR (
  expr
)

Description [src]

The G_STATIC_ASSERT_EXPR() macro lets the programmer check a condition at compile time. The condition needs to be compile time computable.

Unlike G_STATIC_ASSERT(), this macro evaluates to an expression and, as such, can be used in the middle of other expressions. Its value should be ignored. This can be accomplished by placing it as the first argument of a comma expression.

#define ADD_ONE_TO_INT(x) \
  (G_STATIC_ASSERT_EXPR(sizeof (x) == sizeof (int)), ((x) + 1))

Available since: 2.30

This function is not directly available to language bindings.

Parameters

expr

Type: -

A constant expression.