Stephan van Hulst wrote:
Campbell Ritchie wrote:But it studiously avoids trying that sort of calculations. There is no need to know the value of the expression at this stage and the compiler iss programmed to “forget” intermediaate stages. But, as you say, it remembers the type and the expression in line 2 is of type long, so it cannot be assigned to an int.
Matt Wong wrote:. . . even the compiler would be smart enough to calculate that 2 times 10 would fit in an int, . . .