help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

g++ bug?


From: eoolsson
Subject: g++ bug?
Date: 26 Feb 2006 22:49:33 -0800
User-agent: G2/0.2

The following program outputs "FAIL" when compiled with g++, but "PASS"
when compiled with gcc (on IA32):

#include <stdio.h>

int main(void) {
        short a = 0x1a10;
        short b = 0xb34e;

        if((unsigned int)a >= (unsigned int)b)
                printf("FAIL\n");
        else printf("PASS\n");

        return 0;
}

When using g++, the variable "b" seems to be treated as a negative
number even though it is cast to unsigned int. Is this a bug? Any
ideas?

Versions:
g++ (GCC) 3.2.3 20030502
gcc (GCC) 3.2.3 20030502

Thanks,
Erik



reply via email to

[Prev in Thread] Current Thread [Next in Thread]