PCDIDE COMPILER Custom Computer Services Inc (CCS), PCDIDE COMPILER Datasheet - Page 341

PCD C-COMPILER PIC24, DSPIC

PCDIDE COMPILER

Manufacturer Part Number
PCDIDE COMPILER
Description
PCD C-COMPILER PIC24, DSPIC
Manufacturer
Custom Computer Services Inc (CCS)
Type
Compilerr
Datasheet

Specifications of PCDIDE COMPILER

For Use With/related Products
Microchip PIC24/dsPIC®
Lead Free Status / RoHS Status
Not applicable / Not applicable
Other names
429-1008
COMMON QUESTIONS AND ANSWERS
How are type conversions handled?
The compiler provides automatic type conversions when an assignment is performed. Some
information may be lost if the destination can not properly represent the source. For example:
int8var = int16var; Causes the top byte of int16var to be lost.
Assigning a smaller signed expression to a larger signed variable will result in the sign being maintained.
For example, a signed 8 bit int that is -1 when assigned to a 16 bit signed variable is still -1.
Signed numbers that are negative when assigned to a unsigned number will cause the 2's
complement value to be assigned. For example, assigning -1 to a int8 will result in the int8 being
255. In this case the sign bit is not extended (conversion to unsigned is done before conversion to
more bits). This means the -1 assigned to a 16 bit unsigned is still 255.
Likewise assigning a large unsigned number to a signed variable of the same size or smaller will
result in the value being distorted. For example, assigning 255 to a signed int8 will result in -1.
The above assignment rules also apply to parameters passed to functions.
When a binary operator has operands of differing types then the lower order operand is converted
(using the above rules) to the higher. The order is as follows:
The result is then the same as the operands. Each operator in an expression is evaluated
independently. For example:
i32 = i16 - (i8 + i8)
The + operator is 8 bit, the result is converted to 16 bit after the addition and the - is 16 bit, that
result is converted to 32 bit and the assignment is done. Note that if i8 is 200 and i16 is 400 then
the result in i32 is 256. (200 plus 200 is 144 with a 8 bit +)
Float
Signed 32 bit
Unsigned 32 bit
Signed 16 bit
Unsigned 16 bit
Signed 8 bit
Unsigned 8 bit
1 bit
327

Related parts for PCDIDE COMPILER