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 407
(357) illegal conversion of integer to pointer
(Parser)
An integer has been assigned to or otherwise converted to a pointer type. This will usu-
ally mean you have used the wrong variable, but if this is genuinely what you want to
do, use a typecast to inform the compiler that you want the conversion and the warning
will be suppressed. This may also mean you have forgotten the & address operator, for
example:
ally mean you have used the wrong variable, but if this is genuinely what you want to
do, use a typecast to inform the compiler that you want the conversion and the warning
will be suppressed. This may also mean you have forgotten the & address operator, for
example:
int * ip;
int i;
ip = i; /* oops -- did you mean ip = &i ? */
If you do intend to use an expression like this, then indicate that this is so by a cast:
ip = (int *)i;
(358) illegal conversion of pointer to integer
(Parser)
A pointer has been assigned to or otherwise converted to a integral type. This will usu-
ally mean you have used the wrong variable, but if this is genuinely what you want to
do, use a typecast to inform the compiler that you want the conversion and the warning
will be suppressed. This may also mean you have forgotten the * dereference operator,
for example:
ally mean you have used the wrong variable, but if this is genuinely what you want to
do, use a typecast to inform the compiler that you want the conversion and the warning
will be suppressed. This may also mean you have forgotten the * dereference operator,
for example:
int * ip;
int i;
i = ip; /* oops -- did you mean i = *ip ? */
If you do intend to use an expression like this, indicate your intention by a cast:
i = (int)ip;
(359) illegal conversion between pointer types
(Parser)
A pointer of one type (i.e., pointing to a particular kind of object) has been converted
into a pointer of a different type. This will usually mean you have used the wrong vari-
able, but if this is genuinely what you want to do, use a typecast to inform the compiler
that you want the conversion and the warning will be suppressed, for example:
into a pointer of a different type. This will usually mean you have used the wrong vari-
able, but if this is genuinely what you want to do, use a typecast to inform the compiler
that you want the conversion and the warning will be suppressed, for example:
long input;
char * cp;
cp = &input; /* is this correct? */
This is common way of accessing bytes within a multi-byte variable. To indicate that this
is the intended operation of the program, use a cast:
is the intended operation of the program, use a cast:
cp = (char *)&input; /* that’s better */
This warning may also occur when converting between pointers to objects which have
the same type, but which have different qualifiers, for example:
the same type, but which have different qualifiers, for example:
char * cp;
/* yes, but what sort of characters? */
cp = "I am a string of characters";
If the default type for string literals is const char * , then this warning is quite valid.
This should be written:
This should be written:
const char * cp;
cp = "I am a string of characters"; /* that’s better */
Omitting a qualifier from a pointer type is often disastrous, but almost certainly not what
you intend.
you intend.