[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: sqrt C function



Craig Dickson wrote:

Paul Scott wrote:


Well that may date me a little even though I am actively programming at this moment. I will research this a little more. My logic would be it would break the rules of the language to assume that conversion.


I don't see how. I see it as a legitimate compiler optimization. If you
have "double f = 4;", and you compile 4 as a double-precision value
rather than as an int (which would then require an immediate
conversion), how could that possibly break a program?

I wasn't really addressing the optimization question. You could easily be correct about that. I was addressing the definition of the assignment (=) operator. I didn't say it would break the program. Just possibly thwart the programmer's intention in a more compilcated case. Since the code is correct I would expect it to work whether the conversion was done at compile time or execute time.

Take care,

Paul



Reply to: