SW500009 Microchip Technology, SW500009 Datasheet - Page 377

HI-TECH FOR DSPIC/PIC24

SW500009

Manufacturer Part Number
SW500009
Description
HI-TECH FOR DSPIC/PIC24
Manufacturer
Microchip Technology
Type
Compilerr
Series
PIC24 & DsPICr
Datasheet

Specifications of SW500009

Supported Families
PIC24
Core Architecture
PIC, DsPIC
Software Edition
Standard
Kit Contents
Software And Docs
Tool Type
Compiler
Mcu Supported Families
PIC24 MCUs And DsPIC DSCs
Lead Free Status / RoHS Status
Not applicable / RoHS Compliant
For Use With/related Products
DSPIC3X/PIC24
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
Other names
025
778-1003
778-1003
Error and Warning Messages
A quick check with your calculator reveals that 240 * 137 is 32880 which can easily be stored in
an unsigned int, but a warning is produced. Why? Because 240 and 137 and both signed int
values. Therefore the result of the multiplication must also be a signed int value, but a signed
int cannot hold the value 32880. (Both operands are constant values so the code generator can
evaluate this expression at compile time, but it must do so following all the ANSI rules.) The
following code forces the multiplication to be performed with an unsigned result:
(752) conversion to shorter data type
Truncation may occur in this expression as the lvalue is of shorter type than the rvalue, e.g.:
(753) undefined shift (* bits)
An attempt has been made to shift a value by a number of bits equal to or greater than the number of
bits in the data type. This will produce an undefined result on many processors. This is non-portable
code and is flagged as having undefined results by the C Standard, e.g.:
(754) bitfield comparison out of range
This is the result of comparing a bitfield with a value when the value is out of range of the bitfield.
For example, comparing a 2-bit bitfield to the value 5 will never be true as a 2-bit bitfield has a range
from 0 to 3, e.g.:
unsigned int i; /* assume ints are 16 bits wide */
i = 240 * 137;
i = 240u * 137; /* force at least one operand to be unsigned */
char a;
int b, c;
a = b + c; /* conversion of int to char may result in truncation */
int input;
input < <= 33; /* woops -- that shifts the entire value out of input */
struct {
} value;
int compare(void)
{
}
unsigned mask : 2; /* mask can hold values 0 to 3 */
return (value.mask == 6); /* test can
/* this should be okay, right? */
(Code Generator)
(Code Generator)
(Code Generator)
363

Related parts for SW500009