This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

wierdness


/*
* * 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;
}



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]