SW500011 Microchip Technology, SW500011 Datasheet - Page 373

HI-TECH X PRO FOR PIC32

SW500011

Manufacturer Part Number
SW500011
Description
HI-TECH X PRO FOR PIC32
Manufacturer
Microchip Technology
Type
Compilerr
Series
PIC32r
Datasheet

Specifications of SW500011

No. Of User Licenses
1
Supported Families
PIC32
Core Architecture
PIC
Supported Hosts
Windows XP, Vista, Linux, Mac OS X
Software Edition
Professional
Kit Contents
Software And Docs
Tool Type
Compiler
Lead Free Status / RoHS Status
Not applicable / Not applicable
For Use With/related Products
PIC32 Series
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
Other names
032
778-1007
778-1007
Error and Warning Messages
(750) constant operand to || or &&
One operand to the logical operators || or && is a constant. Check the expression for missing or
badly placed parentheses. This message may also occur if the global optimizer is enabled and one of
the operands is an auto or static local variable whose value has been tracked by the code generator,
e.g.:
(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 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:
This warning can also be triggered by intermediate values overflowing. For example:
{
int a;
a = 6;
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
b++;
/* this should be okay, right? */
to be unsigned */
(Code Generator)
(Code Generator)
373

Related parts for SW500011