This is the mail archive of the gcc-bugs@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]

Re: Value not equal to itself


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


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