expressions and #if
buck at NRL-CSS.ARPA
buck at NRL-CSS.ARPA
Thu Jul 12 03:48:37 AEST 1984
From: Joe Buck <buck at NRL-CSS.ARPA>
A look at the yacc grammar for cpp on 4.1bsd shows that yes, the !, &&,
and || operators are supported. The c preprocessor for 4.1bsd knows
about the following operators:
* / % + - << >> < > >= <= == != & ^ | && || ?: ,
UMINUS ! defined
where UMINUS is the unary minus. "defined" is handled as an operator,
not a macro; defined(foo) returns 1 if foo is defined and zero
otherwise. As an operator, it is only evaluated on lines beginning with
"#". Apparently, "defined foo" is equivalent to "defined(foo)".
Once it's decided that any cpp must support some of the unary and binary
operators, the extra work to include others is trivial, so it seems to
me that the K&R listing of legal operators was an error on their part.
"defined", on the other hand, I don't know about.
ARPA: buck at nrl-css.ARPA
UUCP: ...!{decvax,linus,umcp-cs}!nrl-css!buck
-Joe
More information about the Comp.lang.c
mailing list