Is there any way to force Xojo to NOT use Implied Datatype casting?
example
Dim i as Integer=5
Dim d as double=i
Currently (Implied) is valid… Explict datatype would not
Is there any way to force Xojo to NOT use Implied Datatype casting?
example
Dim i as Integer=5
Dim d as double=i
Currently (Implied) is valid… Explict datatype would not
no
intrinsic types like integer double etc will always convert from one to the other where possible
its not possible to turn on an error for a conversion like this
at best you might get a warning
didn’t think so.
I “assume” the compiler does it by inserting some “type conversion” call at the point a different datatype is required
by that I mean (using my above example, which is of course very simplistic)
the compiler actually internally produces something like ???
Dim D as Double
D=Int2Dbl(i)
If so, would that mean that a program written to super strict datatyping, would be slightly smaller/faster (although probably not noticable)
at a very low level there is some conversion code but I dont know if thats done in the compiler and the IR that it generates or where
as for whether it would be smaller or faster thats hard to say as a LOT of really low level stuff like this is done right in the chip itself so you would be measuring microinstruction speed
you end up needing to read stuff like this
https://software.intel.com/en-us/articles/fast-floating-point-to-integer-conversions
enjoy