warning: (1498) pointer (lee_cad_usart@buf) in expression may have no targets

Thread Starter

rfjhh

Joined Jul 9, 2020
1
Hi
I'm writing a program for UART communication with a PIC16F887 as master and a PIC 16F886 as slave. I use MPLABX and XC8 compiler.
I've made a library whit this function:
void lee_cad_usart(char *buf, char longitud)
{
PORTBbits.RB0 = 0;
while(*buf!='\0')
{
PORTBbits.RB0 ^= 1;
while(RCIF == 0){}
*buf++ = lee_usart();
__delay_us(100);
if(!RCIF&&RCIDL)
{
*buf = '\0';
break;
}
}
}

In the master I write:
I declare the array:
char *dato[20];

and in the void main()

lee_cad_usart(*dato, 20);

But in compiling I receive a warning: warning: (1498) pointer (lee_cad_usart@buf) in expression may have no targets

I don't understand why

May somebody help me please

Regards
 

nsaspook

Joined Aug 27, 2009
12,997
I'll take a swing.

char *dato[20];


Is creating an array of twenty char pointers and the function

lee_cad_usart(*dato, 20); // void lee_cad_usart(char *buf, char longitud)

is expecting an pointer to a array of char in the memory of dato[20]



I think the compiler is saying I'm unable to tell if the address in the pointer is runtime null or is pointing to allocated data space while optimizing the program.

http://c-faq.com/aryptr/aryptrequiv.html
http://web.torek.net/torek/c/pa.html
 
Top