38 lines
788 B
Perl
Raw Normal View History

/* n_13.t: Valid operators in #if expression. */
/* Valid operators are (precedence in this order) :
defined, (unary)+, (unary)-, ~, !,
*, /, %,
+, -,
<<, >>,
<, >, <=, >=,
==, !=,
&,
^,
|,
&&,
||,
? :
*/
/* 13.1: Bit shift. */
#if 1 << 2 != 4 || 8 >> 1 != 4
Bad arithmetic of <<, >> operators.
#endif
/* 13.2: Bitwise operators. */
#if (3 ^ 5) != 6 || (3 | 5) != 7 || (3 & 5) != 1
Bad arithmetic of ^, |, & operators.
#endif
/* 13.3: Result of ||, && operators is either of 1 or 0. */
#if (2 || 3) != 1 || (2 && 3) != 1 || (0 || 4) != 1 || (0 && 5) != 0
Bad arithmetic of ||, && operators.
#endif
/* 13.4: ?, : operator. */
#if (0 ? 1 : 2) != 2
Bad arithmetic of ?: operator.
#endif