DEFINITE bug in Turbo C 2.0
D. K. Smith
dks at shumv1.uucp
Fri Mar 23 17:24:35 AEST 1990
In article <802 at zeusa.UUCP> hendrik at zeusa.UUCP (Hendrik Vermooten) writes:
>Here is a definite bug in C (discovered by Renier v. Wyk)
>
>
>#include <stdio.h>
>#define SQR(a) a*a
>main ()
>{
> int a = 10, b = 10, x, y;
>
> x = SQR (++a);
> y = SQR (b++);
> printf ("%d\n", x);
> printf ("%d\n", y);
> a = 10;
> b = 10;
> printf ("%d\n", SQR (++a));
> printf ("%d\n", SQR (b++));
>}
>
Hmmm...
THINK's "old" C compiler (version) 3.02 yields the following:
144
110
144
110
dk smith
More information about the Comp.lang.c
mailing list