On Mon, 12 Aug 2002, Eric M. Monsler wrote:
> I'm jumping lists with this; my apologies, but it's definitely a gtk bug
> and so want to followup to gtk-list.
>
> If I try to print a denormalized float with a specific format string,
> e.g. "%6.2f\n", using g_string_sprintf(), the program crashes with an
> error about allocating a negative number of bytes...
> union {
> int i_val;
> float f_val;
> } the_data;
>
> the_data.i_val = 1;
> pGStr = g_string_new("");
> g_string_sprintf(pGStr,"%6.2f\n",the_data.f_val);
Isn't that undefined behavior, trying to access the wrong member of a
union? Here (gtk 2.0.6) it prints "0.00", but I don't see that it's
obliged to.
Allin Cottrell.
_______________________________________________
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list