...
Code Block | ||||
---|---|---|---|---|
| ||||
/* * Swaps two values. * Requires tmp variable to be defined. */ #define SWAP(x, y) \ tmp = x; \ x = y; \ y = tmp |
...
Code Block | ||||
---|---|---|---|---|
| ||||
/* * Swaps two values. * Requires tmp variable to be defined. */ #define SWAP(x,y) { tmp = x; x = y; y = tmp; } |
...
Code Block | ||||
---|---|---|---|---|
| ||||
if (x > y) { /* Single-branch if-statement!!! */
tmp = x; /* The one and only branch consists */
x = y; /* of the block. */
y = tmp;
}
; /* Empty statement */
else /* ERROR!!! "parse error before else" */
do_something();
|
...
Code Block | ||||
---|---|---|---|---|
| ||||
/* * Swaps two values. * Requires tmp variable to be defined. */ #define SWAP(x, y) \ do { \ tmp = x; \ x = y; \ y = tmp; } \ while (0) |
...