Open sgillespie opened 2 months ago
I did a few experiments with autoconf to see what it does. I tried passing floats/doubles to ac_fn_c_compute_int
, and the results were inconsistent.
If I passed 5.0
/5.0f
without cross-compiling, I correctly got the integer 5
. If I passed 5.1
, the result was 0
. With cross compiling, I got 0
either way.
There are a few options, hsc2hs
could completely disallow non-integrals (as it currently does only with --cross-compile
), but that would break existing packages, including text-icu. Another option, would be to modify the binary search to work with floats, which would essentially result in a cast to integer.
If a const is defined as floating point or double,
--cross-compile
fails with:In the example above,
MyLib.hsc
has the following construct:and
MY_CONST
is defined in a header file with#define MY_CONST ((double)-123456789.)
. This is the function it generates: