On 9/18/06, Kenneth Lumia wrote: > Hi, > > Okay, I'm ready to tear out what's left of my hair! > > I am either making a really stupid error, or there > is a bug in the C18 compiler (PIC18F4620). I'm attempting > to cast a variable from 8 bits to 32 bits and it appears that the > sign is not being properly extended. Just to really annoy > me, I tried it in VC++ and it works correctly. I've > tracked the "bug" down to the following simplified code: > > typedef char INT_8; ^^^^^^^^^^^^^^^^^^^^^^ I'm not familiar with C18, but is a "char" a signed 8-bit quantity or an unsigned 8-bit quantity? It is is signed, you would expect the VC++ behavior. If it is unsigned, you would get the C18 behavior. Try typedef signed char INT_8; and see if that fixes your problem. Bill -- Psst... Hey, you... Buddy... Want a kitten? straycatblues.petfinder.org -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist