On Mon, 29 Mar 2010, Bob Blick wrote: > unsigned char foo; > unsigned char bar; > unsigned char bat; > > if(bat==foo+bar) > Something(); > > The compiler promotes the unsigned chars to integers, does the add and > does the comparison. That is standard C behavior. > In the past I always thought HiTech used the native > data size unless there was a reason not to No, it has never done that and has no option to do that. Perhaps you're thinking of C18, which does that by default. > I haven't been able to find any reference that covers these cases in > 8-bit implementations of "C" C has no special rules for 8-bit processors. Most operators promote their operands to "int" if they are a smaller type. And an int must be at least 16 bits. That being said, a compiler is free to perform such operations on an "as if" basis; it is not required to do 16-bit operations if the end result is the same "as if" 16-bit operations were performed. For example, unsigned char a, b, c; a = b + c; If you try this, you'll most likely see your compiler using 8-bit operations here, even though the + operator must perform integer promotions on "b" and "c". This is possible because the compiler knows the upper bit of the result will be discarded due to the type of "a". > Any idea where I can look for definitive rules on this? The C standard. The standard itself is not free, but you can find copies of drafts online that are close enough. Here is one example: http://flash-gordon.me.uk/ansi.c.txt -- John W. Temples, III -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist