[MLton] C_Int_t format string
Matthew Fluet
fluet@cs.cornell.edu
Wed, 24 May 2006 23:02:39 -0400 (EDT)
> When compiling the runtime on Cygwin, I get the following warnings
>
> basis/Real/gdtoa.c:38: warning: int format, C_Int_t arg (arg 5)
> basis/Real/gdtoa.c:38: warning: int format, C_Int_t arg (arg 6)
> basis/Real/gdtoa.c:72: warning: int format, C_Int_t arg (arg 5)
> basis/Real/gdtoa.c:72: warning: int format, C_Int_t arg (arg 6)
>
> What's the best way to fix these?
I guess Cygwin's gcc doesn't consider int32_t to be equivalent to int.
Probably the best thing to do is to cast the C_Int_t arguments to int;
note, there is an implicit cast in passing the arguments to gdtoa.
So, I'd suggest:
result = gdtoa (&fpi, ex, bits, &i, (int)mode, (int)ndig, (int*)decpt, NULL);
if (DEBUG)
fprintf (stderr, "%s = gdtoa (%g, %d, %d) decpt = %d\n",
result, (double)f, (int)mode, (int)ndig, *((int*)decpt));
C_Int_t is autogenerated to be int<N>_t where N equals sizeof(int) * CHAR_BIT,
so the cast can't be anything other than an identity.