wierdness
Micah Nathan Moore
moore_mn@cobra.cs.mercer.edu
Sun Aug 4 17:51:00 GMT 2002
/*
* * Nathan Moore
* * moore_mn@cobra.cs.mercer.edu
* *
* * The following code compiles error-free with G++ 3.1.1,
* * however, it does not do what I expected it to do.
* * It seems to me that the source code may not be correct
* * C++ (or G++), but what the compiler produces is not
* * what anyone could intend this code to do.
* * At the very least, errors should be produced.
* *
* * */
extern "C" int printf(const char *, ...);
const char * z = "%i %i %i\n";
const int first = 1,
second = 2,
third = 3,
fourth = 4;
int main()
{
int A = 8;
int B = 8;
( A >? B ) = first ;
printf(z,A,B,first);
int X = 9;
int Y = 8;
(X >? Y) = second;
printf(z,X,Y,second);
int M = 7;
int N = 7;
((M>N) ? M : N) = fourth;
printf(z,M,N,fourth);
return 0;
}
More information about the Gcc
mailing list