C18 "suspicious pointer conversion"

Have you got the greatest 48 bit multiplier ever conceived? Prove it - post your code here.

Moderator: phalanx

Post Reply
tylerwolf
Posts: 22
Joined: Sat Oct 02, 2010 1:03 pm
Location: Los Angeles, CA

C18 "suspicious pointer conversion"

Post by tylerwolf » Tue Dec 28, 2010 3:51 pm

Hi,
I've got a program for printing to an LCD that worked in Hi-Tech C, but I'm getting a "suspicious pointer conversion" warning in C18. When I program the chip, I can't print strings (I've tried putting both "this" and 'this'), but I can print individual letters and numbers. The code that gives me the warning looks like this:

Code: Select all

void lcd_puts(unsigned char * var) {
	while(*var)
		lcd_write(*var++);
}
I use unsigned char as the type in lcd_write(), so there's no problem converting there. Anyone ever have to deal with this before?

Thanks!

charliex
Posts: 11
Joined: Tue Aug 25, 2009 1:34 pm

Re: C18 "suspicious pointer conversion"

Post by charliex » Tue Jan 04, 2011 4:33 pm

I'd imagine your test is in ROM and the code is expecting the pointer to be in RAM, either change them to both rom pointers or ram.

RonnyM
Posts: 220
Joined: Wed Feb 15, 2006 11:24 am
Location: Vermont

Re: C18 "suspicious pointer conversion"

Post by RonnyM » Fri Jan 07, 2011 12:38 pm

tylerwolf wrote:Hi,
I've got a program for printing to an LCD that worked in Hi-Tech C, but I'm getting a "suspicious pointer conversion" warning in C18. When I program the chip, I can't print strings (I've tried putting both "this" and 'this'), but I can print individual letters and numbers. The code that gives me the warning looks like this:

Code: Select all

void lcd_puts(unsigned char * var) {
	while(*var)
		lcd_write(*var++);
}
Try lcd_write(*var);
var++;
}

I think you are incrementing the variable value, but not the pointer?

I use unsigned char as the type in lcd_write(), so there's no problem converting there. Anyone ever have to deal with this before?

Thanks!

Post Reply