this macro is used to define other macros
containing multiple statements, in association
with
M_END_STMNT
. they ensure that the new defined macro is
always seen as a single statement by the C
compiler, and can be followed by a semi-column.
As an example, consider the following macro
definitions
#define MULTI1(x,y) (x) = 0; (y) = 0
#define MULTI2(x,y) M_BEGIN_STMNT \
(x) = 0; \
(y) = 0; \
M_END_STMNT
using MULTI1 will result in incorrect behaviour
and/or compilation in cases like:
if (z)
MULTI1(x1,y1);
else
MULTI1(x2,y2);
the problem doesn't happen with MULTI2
|