Microchip Technology XC8 Standard Compiler (Workstation) SW006021-1 SW006021-1 Benutzerhandbuch
Produktcode
SW006021-1
MPLAB
®
XC8 C Compiler User’s Guide
DS52053B-page 438
2012 Microchip Technology Inc.
(761) sizeof yields 0
(Code Generator)
The code generator has taken the size of an object and found it to be zero. This almost
certainly indicates an error in your declaration of a pointer; i.e., you may have declared
a pointer to a zero length array. In general, pointers to arrays are of little use. If you
require a pointer to an array of objects of unknown length, you only need a pointer to a
single object that can then be indexed or incremented.
certainly indicates an error in your declaration of a pointer; i.e., you may have declared
a pointer to a zero length array. In general, pointers to arrays are of little use. If you
require a pointer to an array of objects of unknown length, you only need a pointer to a
single object that can then be indexed or incremented.
(762) constant truncated when assigned to bitfield
(Code Generator)
A constant value is too large for a bitfield structure member to which it is being
assigned, for example:
assigned, for example:
struct INPUT {
unsigned a : 3;
unsigned b : 5;
} input_grp;
input_grp.a = 0x12; /* oops -- 0x12 cannot fit into a 3-bit wide
object */
(763) constant left operand to "? :" operator
(Code Generator)
The left operand to a conditional operator ? is constant, thus the result of the tertiary
operator ?: will always be the same, for example:
operator ?: will always be the same, for example:
a = 8 ? b : c; /* this is the same as saying a = b; */
(764) mismatched comparison
(Code Generator)
A comparison is being made between a variable or expression and a constant value
which is not in the range of possible values for that expression, for example:
which is not in the range of possible values for that expression, for example:
unsigned char c;
if(c > 300) /* oops -- how can this be true? */
close();
(765) degenerate unsigned comparison
(Code Generator)
There is a comparison of an unsigned value with zero, which will always be true or
false, for example:
false, for example:
unsigned char c;
if(c >= 0)
will always be true, because an unsigned value can never be less than zero.
(766) degenerate signed comparison
(Code Generator)
There is a comparison of a signed value with the most negative value possible for this
type, such that the comparison will always be true or false, for example:
type, such that the comparison will always be true or false, for example:
char c;
if(c >= -128)
will always be true, because an 8 bit signed char has a maximum negative value of
-128.
-128.
(767) constant truncated to bitfield width
(Code Generator)
A constant value is too large for a bit-field structure member on which it is operating,
for example:
for example:
struct INPUT {
unsigned a : 3;
unsigned b : 5;
} input_grp;
input_grp.a |= 0x13; /* oops -- 0x13 to large for 3-bit wide object
*/