sergio masci wrote: > XCSB doesn't go the whole hog but it does track this much better than C. > byte_var = byte_var + byte_var // see (1) > (1) ... add operation performed as two bytes This is intuitive, and not significantly different from C. The result is the same. > byte_var = byte_var + word_var // see (2) > (2) ... add operation performed as two bytes This is surprising, and may lead to a wrong result (for signed variables). IMO this should at least trigger a compiler warning. > word_var = byte_var + byte_var // see (3) > (3) ... add operation performed as two words This is not different from C. > byte_var = (byte_var + byte_var) >> k // see (4) > (4) ... add operation performed as two words > shift operation performed on word result Considering 1, this is surprising. In any case, it's safe and not different from C. > byte_var = (ubyte)(byte_var + byte_var) >> k // see (5) > (5) ... add operation performed as two bytes > shift operation performed on byte result This is intuitive and not significantly different from C. The result is the same. Overall, these examples don't seem to show a significant difference from C, with the exception of (2), of which I'm not sure it really makes more sense than the way C does it. > Also comparing signed and unsigned works correctly > > e.g. > if unsigned_byte_var > signed_byte_var then > > always true if unsigned_byte_var > 127 > always false if signed_byte_var < 0 > otherwise true or false as expected > endif This is the same in C. (And as always, when talking about C in a generic fashion, I think ANSI C89 is probably a good candidate.) Gerhard -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist