Jump to content
  • Advertisement

Archived

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

UeberBobo

doubles and ints

This topic is 5547 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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
yes, as AP said it''s only a warning. You can lower your warning level or always cast (static_cast) your types to the expected type

}-- Programmer/Gamer/Dreamer --{

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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!