News for hackers. Stuff that matters.
Re:Both true and false: a Zen moment with C by JoeAltmaier on Thursday June 28, 2012 @10:07AM (#4171723)
Maybe you misapprehend the bool issue? It isn't that bool doesn't match a register; its that the value is stored in memory in a subset of the storage unit i.e. 1 bit out of the byte. That's not true of any other scalar.
Re:Both true and false: a Zen moment with C by lmm on Sunday July 01, 2012 @04:13AM (#4184206)
Suppose you have a char followed by a long in a struct; the compiler will insert seven bytes of padding after the char. There's nothing to prevent it setting the padding to 0 when initializing the char, and using a 64-bit load instruction to load it into a register - in which case you'd get exactly the same behaviour as seen here with bool, only even more confusing.