Re: Crashing g_string_sprintf when printing invalid floats. gtk+-1.2.9 on Linux
- From: Allin Cottrell <cottrell wfu edu>
- To: "Eric M. Monsler" <emonsler beamreachnetworks com>
- Cc: "gtk-list gnome org" <gtk-list gnome org>
- Subject: Re: Crashing g_string_sprintf when printing invalid floats. gtk+-1.2.9 on Linux
- Date: Tue, 13 Aug 2002 20:06:31 -0400 (EDT)
On Tue, 13 Aug 2002, Eric M. Monsler wrote:
> I feel it should not crash on any input.
>
> I have a similar test case, which uses:
>
> tmp_float = (float)strtod("6.0e-44",NULL);
> g_string_sprintf(pGStr,"%6.2f\n",tmp_float);
>
> and produces the same crash.
I'd say that crashing is an acceptable response. It's up to the
programmer to ensure that such functions are fed with input that is
within bounds. In the example above, inspecting errno would have
shown that tmp_float did not have an acceptable value. I suppose one
could say that it's a "quality of implementation" issue, and that a
"nice" library will try to work around invalid input so far as
possible. But I wouldn't describe the crash as a bug, any more than
it's a bug when fprintf() segfaults when fed a null FILE
pointer.
Allin Cottrell.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]