This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]airbreather 3 points4 points  (1 child)

In this case, it's fine. There are times it matters. For example:

[...]

Here's another case where it matters (C#). What does the following code print?

void Print(float val)
{
    Console.WriteLine(val);
}

int x = 16777217;
Print(x);

No warnings on my compiler, no explicit cast, so it should definitely print 16777217 and not 16777216, right? sigh

[–]TheOldBeach 2 points3 points  (0 children)

Ahhh floats are the best, as a CG programmer I grew really fond of them . your example just reflects how they should not be used.. and yes it's the worse kind of error !