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 405
(345) unreachable code
(Parser)
This section of code will never be executed, because there is no execution path by
which it could be reached, for example:
which it could be reached, for example:
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 and preceding the current function or block). This is legal, but can lead to
accidental use of one variable when the outer one was intended, for example:
outside and preceding the current function or block). This is legal, but can lead to
accidental use of one variable when the outer one was intended, for example:
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 restricts the scope of the function declaration to the function body. This means that
if the compiler encounters another declaration, use or definition of the extern object
later in the same file, it will no longer have the earlier declaration and thus will be unable
to check that the declarations are consistent. This can lead to strange behavior of your
program or signature errors at link time. It will also hide any previous declarations of
the same thing, again subverting the compiler’s type checking. As a general rule,
always declare extern variables and functions outside any other functions. For
example:
as it restricts the scope of the function declaration to the function body. This means that
if the compiler encounters another declaration, use or definition of the extern object
later in the same file, it will no longer have the earlier declaration and thus will be unable
to check that the declarations are consistent. This can lead to strange behavior of your
program or signature errors at link time. It will also hide any previous declarations of
the same thing, again subverting the compiler’s type checking. As a general rule,
always declare extern variables and functions outside any other functions. For
example:
int process(int a)
{
/* this would be better outside the function */
extern int away;
return away + a;
}
(348) auto variable "*" should not be qualified
(Parser)
An auto variable should not have qualifiers such as near or far associated with it. Its
storage class is implicitly defined by the stack organization. An auto variable may be
qualified with static , but it is then no longer auto.
storage class is implicitly defined by the stack organization. An auto variable may be
qualified with static , but it is then no longer auto.
(349) non-prototyped function declaration for "*"
(Parser)
A function has been declared using old-style (K&R) arguments. It is preferable to use
prototype declarations for all functions, for example:
prototype declarations for all functions, for example:
int process(input)
int input; /* warning flagged here */
{
}
This would be better written:
int process(int input)
{
}