Why gcc4 warn and how to avoid it

Posted by vitaly.v.ch on Stack Overflow See other posts from Stack Overflow or by vitaly.v.ch
Published on 2010-04-14T15:11:39Z Indexed on 2010/04/14 15:13 UTC
Read the original article Hit count: 572

Filed under:
|
|
|

I have a function declared as:

void    event_add_card (EventAddr addr, EventType type, unsigned char card);

and union

typedef union EventData
{
    float           money;      /**< money info */
    unsigned char   card;       /**< new card */
}
EventData;

When i compile following code:

EventData data = {};

event_add_card (0,0, data.card);

with enabled warning -Wconversion I receive following warning:

player-stud.c|71| warning: passing argument 3 of 'event_add_card' with different width due to prototype

Why gcc4 unsuccessful and how to fix It???

© Stack Overflow or respective owner

Related posts about gcc

Related posts about gcc-warning