Pádraig Brady <[email protected]> writes: > +#if HAVE_C99_STRTOLD /* provided by c-strtold module. */ > +# define STRTOD strtold > +#else > +# define STRTOD strtod > +#endif > + > char *ea; > char *eb; > - double a = strtod (sa, &ea); > - double b = strtod (sb, &eb); > + long double a = STRTOD (sa, &ea); > + long double b = STRTOD (sb, &eb);
This could cause performance problems on machines that have slow long-double operations (implemented via traps, say) and that lack strtold. How about doing something like this instead? It tries to move as much of the mess as possible to the #if part. #if HAVE_C99_STRTOLD # define long_double long double #else # define long_double double # undef strtold # define strtold strtod #endif ... long_double a = strtold (sa, &ea); long_double a = strtold (sa, &ea);
