11.07.2015 Views

PicC 9.50 dsPIC Manual.pdf

PicC 9.50 dsPIC Manual.pdf

PicC 9.50 dsPIC Manual.pdf

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Error and Warning Messages(755) division by zero (Code Generator)A constant expression that was being evaluated involved a division by zero, e.g.:a /= 0; /* divide by 0: was this what you were intending */(757) constant conditional branch (Code Generator)A conditional branch (generated by an if, for, while statement etc.) always follows the same path.This will be some sort of comparison involving a variable and a constant expression. For the codegenerator to issue this message, the variable must have local scope (either auto or static local) andthe global optimizer must be enabled, possibly at higher level than 1, and the warning level thresholdmay need to be lower than the default level of 0.The global optimizer keeps track of the contents of local variables for as long as is possible duringa function. For C code that compares these variables to constants, the result of the comparison canbe deduced at compile time and the output code hard coded to avoid the comparison, e.g.:{int a, b;a = 5;if(a == 4) /* this can never be false; always perform the true statement */b = 6;will produce code that sets a to 5, then immediately sets b to 6. No code will be produced for thecomparison if(a == 4). If a was a global variable, it may be that other functions (particularlyinterrupt functions) may modify it and so tracking the variable cannot be performed.This warning may indicate more than an optimization made by the compiler. It may indicate anexpression with missing or badly placed parentheses, causing the evaluation to yield a value differentto what you expected.This warning may also be issued because you have written something like while(1). To producean infinite loop, use for(;;).A similar situation arises with for loops, e.g.:{int a, b;for(a=0; a!=10; a++) /* this loop must iterate at least once */b = func(a);In this case the code generator can again pick up that a is assigned the value 0, then immediatelychecked to see if it is equal to 10. Because a is modified during the for loop, the comparisoncode cannot be removed, but the code generator will adjust the code so that the comparison is not307

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!