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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Error and Warning Messages(344) non-void function returns no value (Parser)A function that is declared as returning a value has a return statement that does not specify a returnvalue, e.g.:int get_value(void){if(flag)return val++;return; /* what is the return value in this instance? */}(345) unreachable code (Parser)This section of code will never be executed, because there is no execution path by which it could bereached, e.g.:while(1) /* how does this loop finish? */process();flag = FINISHED; /* how do we get here? */(346) declaration of * hides outer declaration (Parser)An object has been declared that has the same name as an outer declaration (i.e. one outside andpreceding the current function or block). This is legal, but can lead to accidental use of one variablewhen the outer one was intended, e.g.:int input; /* input has filescope */void process(int a){int input; /* local blockscope input */a = input; /* this will use the local variable. Is this right? */(347) external declaration inside function (Parser)A function contains an extern declaration. This is legal but is invariably not desirable as it restrictsthe scope of the function declaration to the function body. This means that if the compiler encountersanother declaration, use or definition of the extern object later in the same file, it will no longer havethe earlier declaration and thus will be unable to check that the declarations are consistent. Thiscan lead to strange behaviour of your program or signature errors at link time. It will also hide anyprevious declarations of the same thing, again subverting the compiler’s type checking. As a generalrule, always declare extern variables and functions outside any other functions. For example:269

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

Saved successfully!

Ooh no, something went wrong!