P99

◆ P99_MACRO_VAR

#define P99_MACRO_VAR (   NAME,
  EXPR,
  QUAL 
)

Define a variable with NAME that has the type and value of EXPR.

If QUAL is given it must be a qualifier list that is added to the resulting type.

Remarks
Other than just redeclaring NAME this macro is safe even if EXPR contains the evaluation of a variable of the same name NAME.

This is achieved by declaring two variables, one with a dummy name that receives EXPR as an initializer (so there can't be a name conflict), and then NAME that is initialized with the first. Any normal optimizer should optimize that auxiliary variable out.

Remarks
argument 0 must be an identifier
argument 1 maybe evaluated several times for its type but only once for its value

Definition at line 1268 of file p99_for.h.