In a sample program, I found some strange declaration in it.
what do they mean? Simply deltaY = 1.0 and halfDeltaY = 0.5?Code:float deltaY = 1.0f; float halfDeltaY = .5f;
In a sample program, I found some strange declaration in it.
what do they mean? Simply deltaY = 1.0 and halfDeltaY = 0.5?Code:float deltaY = 1.0f; float halfDeltaY = .5f;
Last edited by rosicky2005; 11-06-2006 at 09:19 PM.
if you write a floating point literal in C++ (i.e. 3.14) the compiler interprets it as a double precision float (or more simple as type double).
the f suffix simply tells the compiler you're explicitly requesting a float type.
this is present with other literals as well
Code:int x = 1; int y = 010; // is actually octal assert(y == 8); unsigned char = 128u; // tells the compiler the value is unsigned (i.e. 0 to 255, instead of -128 to 127)
"I saw a sign that said 'Drink Canada Dry', so I started"
-- Brendan Behan
Free Compiler: Visual C++ 2005 Express
If you program in C++, you need Boost. You should also know how to use the Standard Library (STL). Want to make games? After reading this, I don't like WxWidgets anymore. Want to add some scripting to your App?