2017-10-21 23:40:19 +00:00
|
|
|
/* Conformance Test 3.3.6.1: Verify precedence setting with parentheses */
|
|
|
|
/* in macro expansions */
|
|
|
|
|
2022-10-17 22:50:42 +00:00
|
|
|
int printf(const char *, ...);
|
|
|
|
|
2017-10-21 23:40:19 +00:00
|
|
|
#define SQUARE1(x) x * x
|
|
|
|
#define SQUARE2(x) (x) * (x)
|
|
|
|
#define SQUARE3(x) ( (x) * (x) )
|
|
|
|
|
2022-10-17 22:50:42 +00:00
|
|
|
int main (void)
|
2017-10-21 23:40:19 +00:00
|
|
|
{
|
|
|
|
float y;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
y = 3.5;
|
|
|
|
y = (int) SQUARE1 (y + 1);
|
|
|
|
if (y != 7.5)
|
|
|
|
goto Fail;
|
|
|
|
|
|
|
|
y = (int) SQUARE2 (y + 1);
|
|
|
|
if (y != 68.0)
|
|
|
|
goto Fail;
|
|
|
|
|
|
|
|
i = (int) SQUARE3 (y + 1);
|
|
|
|
if (i != 4761)
|
|
|
|
goto Fail;
|
|
|
|
|
|
|
|
printf ("Passed Conformance Test 3.3.6.1\n");
|
2022-10-17 22:50:42 +00:00
|
|
|
return 0;
|
2017-10-21 23:40:19 +00:00
|
|
|
|
|
|
|
Fail:
|
|
|
|
printf ("Failed Conformance Test 3.3.6.1\n");
|
|
|
|
}
|
|
|
|
|