Pointer Incrementing Warning

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 */
}

when I compile this it gives the following warning message,
 .\FILENAME(LINENUMBER): warning C275: FILENAME: expression with possibly no effect 

Is there any way to avoid this warning message?? Thank you,

With Regards,
Yaswanth

Proudly wasting time since 1981 

Parents
  • Yaswanth,
    if you use:

    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 */
    }
    
    instead of your original notation (no *Data_Ptr++;) you get same result but no any
    warning.

    BTW:
    Your line -
       char xdata *Data_Ptr = 0x0000; 
    
    is same as
       char xdata *Data_Ptr;
       Data_Ptr = 0x0000; 
    


    Regards,
    Vaclav

Reply
  • Yaswanth,
    if you use:

    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 */
    }
    
    instead of your original notation (no *Data_Ptr++;) you get same result but no any
    warning.

    BTW:
    Your line -
       char xdata *Data_Ptr = 0x0000; 
    
    is same as
       char xdata *Data_Ptr;
       Data_Ptr = 0x0000; 
    


    Regards,
    Vaclav

Children
More questions in this forum