Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

One more compiler warning

Status
Not open for further replies.

WayneRyan

Programmer
May 23, 2002
202
US
Hi,

One more compiler warning:

Error: C4761
integral size mismatch in argument; conversion supplied

offending line:
sa_stuff_dump(msg, one_hdw.sa, sa_index[msg]);

msg unsigned short
one_hdw.sa hdw_data unsigned int
sa_index[msg] unsigned short

Function def:
void sa_stuff_dump(unsigned short, unsigned short, unsigned short);


change call to:
sa_stuff_dump(msg, (unsigned short) (one_hdw.sa), sa_index[msg]);

Is that it?
Have to travel to get to the source & compiler ...

Wayne

 
why don't you try redefining second parameter of your

sa_struff_dump function to "unsigned int" ?,

that is safer than trying to force down "unsigned int" to "unsigned short", the problem is that unsigned short variables uses 2 bytes, and they can represent values from 0 to 65535, and unsigned int depend on the configuration of your system but they can be 2 or 4 bytes,

Hope this helps,

Ricardo
 
Ricardo,

Thanks, I would like to do that, but ...

This app has been running fine for a long time, they
don't really want to "change" things. We are just
trying to clean up compiler warnings.

There are several instances of float to integer assignments,
they don't generate run-time errors.

I was just checking to see if my syntax was correct.

Thanks again, you guys are pretty responsive on this
forum.

Wayne
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top