|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
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
|
|
#2
|
|||||
|
|||||
|
Re: EasyC Assignment rules
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 |
|
#3
|
|||||
|
|||||
|
Re: EasyC Assignment rules
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. |
|
#4
|
|||
|
|||
|
Re: EasyC Assignment rules
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 |
|
#5
|
||||
|
||||
|
Re: EasyC Assignment rules
If you are looking for the sizes open the help file click on "Index" and type/paste
"Variable definitions table" |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| MS Vista/EasyC & EasyC Pro | rswsmay | Programming | 1 | 25-04-2007 10:47 |
| Help on a Homework Assignment. | Pavan Dave | General Forum | 1 | 13-09-2006 14:20 |
| Kickoff easyC workshop integrated into EasyC help file | Dan Larochelle | Programming | 0 | 11-01-2006 06:12 |
| Student assignment at Championship | Andrew Schuetze | Team Organization | 7 | 07-04-2005 23:24 |