We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi Friends, I'm Currently working on C51v6.02 developed by Keil, I'm facing a problem with the compiler when I compile a similar code like this
main() { char xdata *Data_Ptr = 0x0000; /* Pointer to the 0x000 location */ while(some loop) *Data_Ptr++; /* Points to the next data location on the RAM-- here 0x0001 */ }
.\FILENAME(LINENUMBER): warning C275: FILENAME: expression with possibly no effect
Proudly wasting time since 1981
I'm afraid, that's not true. The two statements are equivalent. The ++ and * operators have same precedence but are evaluated right to left. - Mike
Oh yeah. Maybe that's the reason for the warning: the pointer has been incremented, and then dereferenced, but nothing has been done with the dereferenced value?
Andrew,
*Data_Ptr++ // Increments the value of the data pointed-to by the pointer!
(*Data_Ptr)++;