Archived

This topic is now archived and is closed to further replies.

UeberBobo

doubles and ints

Recommended Posts

i have some compile errors of the type: 273 pong.cpp warning: `double'' used for argument 2 of `SetPixelV(HDC__ *, int, int, long unsigned int)'' yes im putting a double in there and it should be an int, things compile and work tho. should i do something aobut this, converting the double to int, (in that case how?) or is it alright to leave it as it is?(any performance loss or other evil stuff?) thx

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
YOu might wanna do a static_cast<int>(your variable) to make it more obvious whats going on.. that will also remove the warning

Share this post


Link to post
Share on other sites
A warning is well.. a warning

Your compiler tells you that there is something which is possible to do but could become an error if you''re not aware of it.

If you cast it you tell the compiler that you know what you''re doing and he shuts up

Share this post


Link to post
Share on other sites
Unless there is something fishy with your variables, just do:

double your_double = 1.3;
SetPixelV(hd, (int)your_double, what, ever);


[edited by - CWizard on October 5, 2003 1:11:22 PM]

Share this post


Link to post
Share on other sites