Reputation: 86
I just wondering what changes in terms of performance for writing an int instead a double for double:
double x = 2; instead double x = 2.0
Upvotes: 1
Views: 110
Reputation: 77324
Since this statement has to be parsed and understood by the compiler at compile time, there is no runtime benefit of one way of writing the constant number over another.
Whether your code may or may not compile a split-microsecond faster is not really of any interest. Write it in a way it is easy to understand for the human reader, because that is the bottleneck when working with code.
Upvotes: 3