Re: Crashing g_string_sprintf when printing invalid floats. gtk+-1.2.9 on Linux




Yes.  I understand the limitations of strtod.

Much of this thread could have been avoided if I had used:

f_val = 6.2e-21;
f_val *= 1.0e-21;

in my example code. I used the union example because that's how I found the problem, I used the double to float cast because that's how I tested that the compiler thought I had a reasonable floating point value, and it still crashed.

Can we pretend my example was:

f_val = 6.2e-21;
f_val *= 1.0e-21;
g_string_sprtinf(pGStr,"%6.2f",f_val);

instead?

Two valid floats, a valid operation, a valid format string of "%6.2f", a call to g_string_sprintf() from which control never returns.


Eric




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]