EasyC Assignment rules

Question is where can I get the assignment rules when using mixed types in an assignment expression. Does ANSI C apply? TNX

Can you please explain a little bit further as to what you are referencing, and perhaps what you are trying to do?

We’d love to help! Just need more info.

Jacob

The place where Microchip C diverges significantly from ANSI C is exactly what jonboy was asking about.

What you need to know is this: the compiler looks at the size of the operands when choosing the precision of the operator, and picks the smallest number of bits that will fit both operands. It doesn’t care about the size of what you’re storing the result in. If you’re adding or multiplying two chars, the answer will be a char and overflow will be an issue. The typical workaround is to cast one of the operands as (int) in order to force the compiler to do 16-bit arithmetic instead of just 8.

Alan:

TNX for the reply. You hit the nail on the head. I was hoping the EasyC expert on the board would have the definitive answer. Not a big deal, but it would remove some of the mystery sooner and with greater ease.
TNX agn

If you are looking for the sizes open the help file click on “Index” and type/paste
“Variable definitions table”