Weird gcc behavior
#5
Hmm, so it seems the standard says that any number can be converted to a boolean according to the rule "zero is false, nonzero is true), but bool veriables only hold the value of zero or one. However, we do a memset(BoolArray, 0xff, ...); which breaks this.

I actually verified this by looking at the disassembly produced by gcc - it checks specifically for the value "1", in the "if (!CanBe)"
Reply
Thanks given by:


Messages In This Thread
Weird gcc behavior - by xoft - 11-18-2012, 11:35 PM
RE: Weird gcc behavior - by ThuGie - 11-19-2012, 01:15 AM
RE: Weird gcc behavior - by FakeTruth - 11-19-2012, 03:10 AM
RE: Weird gcc behavior - by xoft - 11-19-2012, 03:50 AM
RE: Weird gcc behavior - by xoft - 11-19-2012, 07:43 AM
RE: Weird gcc behavior - by FakeTruth - 11-19-2012, 07:57 AM
RE: Weird gcc behavior - by xoft - 11-19-2012, 04:19 PM
RE: Weird gcc behavior - by FakeTruth - 11-19-2012, 05:56 PM



Users browsing this thread: 1 Guest(s)