wende <sj**********@yahoo.co.uk> wrote:
1.
#define MA \
...
{
i = j;
}
...
2
#define MA \
...
do{
i = j;
}while(0);
The usual idiom is to leave off the trailing semicolon - and it's only
useful with multiple-statement macros, so it is this:
#define MA \
{ \
i = j; \
j = k; \
}
versus this:
#define MA \
do { \
i = j; \
j = k; \
} while (0)
With the former definition, this code:
if (test)
MA;
else
puts("no");
is an error, but with the latter definition it is not. This is because
MA; is two statements with the former definition and one statement with
the latter.
- Kevin.