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(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 pointerof a different type. This will usually mean you have used the wrong variable, but if this is genuinelywhat you want to do, use a typecast to inform the compiler that you want the conversion and thewarning will be suppressed, e.g.: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 theintended 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, e.g.:char * cp;cp = “I am a string of characters”; /* yes, but what sort of characters? */If the default type for string literals is const char *, then this warning is quite valid. This shouldbe 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.(360) array index out of bounds (Parser)An array is being indexed with a constant value that is less than zero, or greater than or equal to thenumber of elements in the array. This warning will not be issued when accessing an array elementvia a pointer variable, e.g.:int i, * ip, input[10];i = input[-2]; /* woops -- this element doesn’t exist */ip = &input[5];i = ip[-2]; /* this is okay */273

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

Saved successfully!

Ooh no, something went wrong!