SW500007 Microchip Technology, SW500007 Datasheet - Page 389

PICC-18 PRO

SW500007

Manufacturer Part Number
SW500007
Description
PICC-18 PRO
Manufacturer
Microchip Technology
Type
Compilerr
Series
PIC18r
Datasheets

Specifications of SW500007

Supported Families
PIC18
Core Architecture
PIC
Software Edition
Professional
Kit Contents
Software And Docs
Mcu Supported Families
PIC18
Tool Function
Compiler
Tool Type
Compiler
Lead Free Status / RoHS Status
Not applicable / RoHS Compliant
For Use With/related Products
PIC18 Series
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
Other names
015P
778-1002
778-1002
Error and Warning Messages
(751) arithmetic overflow in constant expression
A constant expression has been evaluated by the code generator that has resulted in a value that is
too big for the type of the expression. The most common code to trigger this warning is assignments
to signed data types. For example:
As a signed 8-bit quantity, c can only be assigned values -128 to 127. The constant is equal to 255
and is outside this range. If you mean to set all bits in this variable, then use either of:
which will set all the bits in the variable regardless of the size of the variable and without warning.
A quick check with your calculator reveils 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.:
This warning can also be triggered by intermediate values overflowing. For example:
if(a || b) /* a is 6, therefore this is always true */
signed char c;
c = 0xFF;
c = ~0x0;
c = -1;
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 */
b++;
/* this should be okay, right? */
(Code Generator)
(Code Generator)
375

Related parts for SW500007