Microchip Technology XC8 Standard Compiler (Workstation) SW006021-1 SW006021-1 User Manual
Product codes
SW006021-1
Error and Warning Messages
2012 Microchip Technology Inc.
DS52053B-page 437
A similar situation arises with for loops, for example:
{
int a, b;
/* this loop must iterate at least once */
for(a=0; a!=10; a++)
b = func(a);
In this case the code generator can again pick up that a is assigned the value 0, then
immediately checked to see if it is equal to 10. Because a is modified during the for
loop, the comparison code cannot be removed, but the code generator will adjust the
code so that the comparison is not performed on the first pass of the loop; only on the
subsequent passes. This may not reduce code size, but it will speed program
execution.
immediately checked to see if it is equal to 10. Because a is modified during the for
loop, the comparison code cannot be removed, but the code generator will adjust the
code so that the comparison is not performed on the first pass of the loop; only on the
subsequent passes. This may not reduce code size, but it will speed program
execution.
(758) constant conditional branch: possible use of "=" instead of "=="
(Code Generator)
There is an expression inside an if or other conditional construct, where a constant is
being assigned to a variable. This may mean you have inadvertently used an assign-
ment = instead of a compare ==, for example:
being assigned to a variable. This may mean you have inadvertently used an assign-
ment = instead of a compare ==, for example:
int a, b;
/* this can never be false;
always perform the true statement */
if(a = 4)
b = 6;
will assign the value 4 to a, then , as the value of the assignment is always true, the
comparison can be omitted and the assignment to b always made. Did you mean:
comparison can be omitted and the assignment to b always made. Did you mean:
/* this can never be false;
always perform the true statement */
if(a == 4)
b = 6;
which checks to see if a is equal to 4.
(759) expression generates no code
(Code Generator)
This expression generates no output code. Check for things like leaving off the
parentheses in a function call, for example:
parentheses in a function call, for example:
int fred;
fred; /* this is valid, but has no effect at all */
Some devices require that special function register need to be read to clear hardware
flags. To accommodate this, in some instances the code generator does produce code
for a statement which only consists of a variable ID. This may happen for variables
which are qualified as volatile. Typically the output code will read the variable, but
not do anything with the value read.
flags. To accommodate this, in some instances the code generator does produce code
for a statement which only consists of a variable ID. This may happen for variables
which are qualified as volatile. Typically the output code will read the variable, but
not do anything with the value read.
(760) portion of expression has no effect
(Code Generator)
Part of this expression has no side effects, and no effect on the value of the expression,
for example:
for example:
int a, b, c;
a = b,c; /* "b" has no effect,
was that meant to be a comma? */