...
| Code Block | ||||
|---|---|---|---|---|
| ||||
#define ABS(x) (((x) < 0) ? -(x) : (x))
void func(int n) {
/* Validate n is within the desired range. */
int m = ABS(++n);
/* ... */
} |
...
| Code Block | ||||
|---|---|---|---|---|
| ||||
#define ABS(x) (((x) < 0) ? -(x) : (x)) /* UNSAFE */
void func(int n) {
/* Validate n is within the desired range. */
++n;
int m = ABS(n);
/* ... */
} |
...
| Code Block | ||||
|---|---|---|---|---|
| ||||
inline int abs(int x) {
return (((x) < 0) ? -(x) : (x));
}
void func(int n) {
/* Validate n is within the desired range. */
int m = abs(++n);
/* ... */
} |
...