The following example typechecks and compiles, which makes me think that
certain castfns are implemented behind the scenes (like those that may be
well-defined in native C):
// test float to double and double to float
extern
castfn
double_to_float
(x: double): float
extern
castfn
float_to_double
(x: float): double
implement main0 () =
{
val x: double = 7.0
val xf:float = double_to_float(x)
val xd: double = float_to_double(xf)
// val xd2: double = xf // sensibly doesn’t typecheck
}
Yes, this only works for generating C code from ATS source.On Wednesday, February 26, 2014 10:36:00 AM UTC-5, Brandon Barker wrote:
The following example typechecks and compiles, which makes me think that
certain castfns are implemented behind the scenes (like those that may be
well-defined in native C):
// test float to double and double to float
extern
castfn
double_to_float
(x: double): float
extern
castfn
float_to_double
(x: float): double
implement main0 () =
{
val x: double = 7.0
val xf:float = double_to_float(x)
val xd: double = float_to_double(xf)
// val xd2: double = xf // sensibly doesn’t typecheck
}