I see several programmers, including Apple, creating codes where they declare stuff like this:
CGRect myRect = CGRectMake (0.f, 0.f, 20.f, 10.f);
or
[myView setAlpha:.7f];
instead of
CGRect myRect = CGRectMake (0.0f, 0.0f, 20.0f, 10.0f);
// and
[myView setAlpha:0.7f];
what the advantage of doing that? Smaller final binary? Faster code?
thanks.
This is just laziness/taste: both
0.fand0.0fas well as.7fand0.7fproduce exactly the same floating point numbers. There is no difference whatsoever, it’s only that the C syntax allows to omit the zero before or after that dot.