C51 COMPILER V9.53.0.0 LX51 LINKER/LOCATER V4.66.30.0
I have the following (relevant) lines of code:
extern xdata uint8_t rtu_rx_buf[]; extern xdata uint8_t rtu_tx_buf[]; . . . struct{ uint8_t func; uint16_t start; uint16_t qty; uint8_t n; }xdata *p = &rtu_rx_buf[1]; . . . p = rtu_tx_buf; . . .
The first assignment to 'p' doesn't raise any complaints from the compiler or linker. The second, however, gives me the following warnings:
*** WARNING C182 IN LINE 98 OF C:\blahblahblah.c: pointer to different objects *** WARNING L25: DATA TYPES DIFFERENT
I'm pretty sure I don't see the difference; am I missing something here?
I thought I'd posted this - but, apparently, not.
Note that the 2 warnings you initially posted are from different tools: one is from the Linker; the other is from the compiler.
There's not enough context there to see which diagnostic refers to which source line, but I'd guess that the compiler warning refers to the assignment, whereas the linker warning refers to the initialisation?
This could also account for why the warnings changed when you changed to two assignments - but you didn't show the actual messages in that case.
But proper casting should have fixed them all...