...
In this noncompliant code example, EOF
is defined as -1
. The macro replacement list consists of a unary negation operator ' - ' followed by an integer literal ' 1'.
Code Block | ||
---|---|---|
| ||
#define EOF -1 /* ... */ if (getchar() EOF) { /* ... */ } |
...
Code Block | ||
---|---|---|
| ||
enum { EOF = -1 }; /* ... */ if (getchar() != EOF) { /* ... */ } |
Exceptions
PRE02-EX1. : A macro that expands to a single identifier or function call is not affected by the precedence of any operators in the surrounding expression, so its replacement list need not be parenthesized.
...