doubles and ints

Started by
3 comments, last by UeberBobo 20 years, 6 months ago
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
//---------//Ueberbobo//*********
Advertisement
YOu might wanna do a static_cast<int>(your variable) to make it more obvious whats going on.. that will also remove the warning
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 --{
[ ThumbView: Adds thumbnail support for DDS, PCX, TGA and 16 other imagetypes for Windows XP Explorer. ] [ Chocolate peanuts: Brazilian recipe for home made chocolate covered peanuts. Pure coding pleasure. ]
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
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]

This topic is closed to new replies.

Advertisement