Let's assume a declared variable float Price
. I want to do Price = Price + 3;
Is it more efficient (for compiling time) to do Price = Price + 3.0;
?
My understanding is that constants have types that are detected during lexical analysis, and when the operation is detected during compilation, if the types are not compatible, the compiler will need to do a lossless conversion for the right operands. I don't think there will be an int
-to-float
conversion in the assembler code, since the conversion can be done during compiling, but is there an int
-to-float
conversion during compiling time (implying more time in processing)?