b1a Subj : Re: Win98 error To : borland.public.cpp.borlandcpp From : maeder@glue.ch (Thomas Maeder [TeamB]) Date : Sun Mar 14 2004 10:25 am Bob Gonder writes: > I suppose I'd need to write it as if( ByteB < (BYTE)27 ) > That for sure's gotta get me a byte compare...but it seems rather > redundant. This will not get you a byte compare. "The usual arithmetic conversions are performed on operands of arithmetic or enumeration type" (ISO C++ Standard, §5.9/2). Assuming that BYTE is a typedef for unsigned char, this means that both operands of < are converted to unsigned int before the comparison takes place. I have the feeling that you tend to do premature optimizations. What the compiler makes out of the situation is a different story, of course. The assembly code for typedef unsigned char BYTE; BYTE f(); void g() { BYTE ByteB = f(); if (ByteB<27) ++ByteB; } void h() { BYTE ByteB = f(); if (ByteB<(BYTE)27) ++ByteB; } void i() { BYTE ByteB = f(); BYTE const twentySeven(27); if (ByteB Side note: > _Are_ ints going to be 64 soon? One some platforms, yes. > I've been very carefull to never place ints in structs. > That's good, right? As a general rule, I don't agree. If you have a compelling reason for doing this in particular struct types, then it's certainly good (by definition of "compelling"). Do you have such a reason? . 0