Value not equal to itself

Andrew Pinski pinskia@gmail.com
Sun May 27 10:22:00 GMT 2012


On Sat, May 26, 2012 at 8:25 PM, Jordan Foster <jrdnfstr92@gmail.com> wrote:
> gcc -v; gcc version 4.2.1 20070831 patched [FreeBSD]
> uname -srip; FreeBSD 9.0-RELEASE i386 GENERI
> Compiler command; gcc47 minimalErroringCode.cpp -o minimalErroringCode
> Test; ./minimalErroringCode
> Expected; no output
> Result; Assertion failed: ((buffer[0] = 0xFF) && buffer[0] == 0xFF),
> function main, file minimalErroringCode.cpp, line 4.

Easy answer buffer[0] when promoted to int because of the rules of
C/C++, is equal to -1 and not 255.  So a signed char will never equal
to 0xff.

Thanks,
Andrew Pinski



More information about the Gcc-bugs mailing list