...
The compliant solution would be to write the macro definitions without the semicolon
at the end and leaving the decision to have a semicolon
or not up to the user who is using the macro.
Code Block | ||
---|---|---|
| ||
#define FOR_LOOP(n) for(i=0; i<(n); i++) main() { int i; FOR_LOOP(3) { printf("Inside for loop\n"); } } |
...
The compliant solution would be to write the macro definitions without the semicolon
at the end and leaving the decision to have a semicolon
or not up to the user while using the macro.
Code Block | ||
---|---|---|
| ||
#define INCREMENT(x, max) ((x) = ((x) + 1) % (max)) main() { int index = 0; int value; value = INCREMENT(index, 10) + 2; ......... .......... } |
...