3 type: bool, char, unsigned char, unsigned short, unsigned long
16 #pragma disable_warning 180 //no warning about using complement on bit/unsigned char
19 #ifdef __bool_true_false_are_defined
23 char foo(bool a
, bool b
, char c
)
28 char complement(bool a
, bool b
)
33 {type
} _0
= 0, _1
= 1, _ff
= 0xFF, _ffff
= -1;
35 #endif //__bool_true_false_are_defined
41 #ifdef __bool_true_false_are_defined
43 ASSERT (foo(x
,3,4) == 6);
45 ASSERT (complement (~_0
, 1));
46 ASSERT (complement (~_1
, 1));
48 #if !(defined(__SUNPRO_C) && defined(__i386))
49 /* this test fails on Solaris i386 SunPro C compiler with -xO2 option;
50 it pass without -xO2 option !? */
51 #if defined TYPE_char && CHAR_MIN < 0
52 ASSERT (complement (~_ff
, 0));
54 ASSERT (complement (~_ff
, 1));
59 ASSERT (complement (~_ffff
, 1));
60 #elif defined TYPE_char && CHAR_MIN < 0
61 ASSERT (complement (~_ffff
, 0));
63 if (sizeof({type
}) < sizeof(int))
64 ASSERT (complement (~_ffff
, 1));
66 ASSERT (complement (~_ffff
, 0));
69 #endif //__bool_true_false_are_defined