warning: #1441-D: nonstandard cast on lvalue

Hello guys, i am having this errore with the following code:

startLinst(Timer_u *head){ Timer_u *ptr;

(Timer_u *)ptr->list1->pnext = *head;
} where head is the pointer to the head of a linked list.

the ADT is:
typedef union TIMER_U{ Timer4 *timer4; Timer3 *timer3; Timer2 *timer2; Timer1 *timer1;
}Timer_u;

typedef struct TIMER1{ unsigned char TimerID; unsigned char cnt; unsigned char processo:6; unsigned char type:2; union Timer_u *pnext;
}Timer1;

Can anyone help me to avoid this warning message?

Parents
  • I will re-write the code:

    startLinst(Timer_u *head){
        Timer_u *ptr;
    
        (Timer_u *)ptr->list1->pnext = *head;
    }
    

    where head is the pointer to the head of a linked list.

    the ADT is:

    typedef union TIMER_U{
        Timer4 *timer4;
        Timer3 *timer3;
        Timer2 *timer2;
        Timer1 *timer1;
    }Timer_u;
    
    typedef struct TIMER1{
        unsigned char TimerID;
        unsigned char cnt;
        unsigned char processo:6; unsigned char type:2;
        union Timer_u *pnext;
    }Timer1;
    

    Can anyone help me to avoid the warning message 1441?

Reply
  • I will re-write the code:

    startLinst(Timer_u *head){
        Timer_u *ptr;
    
        (Timer_u *)ptr->list1->pnext = *head;
    }
    

    where head is the pointer to the head of a linked list.

    the ADT is:

    typedef union TIMER_U{
        Timer4 *timer4;
        Timer3 *timer3;
        Timer2 *timer2;
        Timer1 *timer1;
    }Timer_u;
    
    typedef struct TIMER1{
        unsigned char TimerID;
        unsigned char cnt;
        unsigned char processo:6; unsigned char type:2;
        union Timer_u *pnext;
    }Timer1;
    

    Can anyone help me to avoid the warning message 1441?

Children
More questions in this forum