RE: g_log () with NULL arg crashes on Win32



> > If I have a variable:
> >
> > 	gchar *test = NULL;
> >
> > And I call:
> >
> > 	printf ("variable has value:'%s'", test);
> >
> > It works, as expected, but if I use:
> >
> > 	g_message ("variable has value:'%s'", test);	
> 
> 
> The problem is what you expect.  You should not expect anything
because
> the behaviour is undefined.  It might print "(null)", clean your
kitchen,
> or go into a loop.  Use something like...
> 
>     printf ("variable has value:'%s'", test ? test : "(null)");
> and
>     g_message ("variable has value:'%s'", test ? test : "(null)");
> 

Although I agree with what you are saying, it is quite a convenience to
see that a variable is set to NULL.  To add the conditional expression
can be easily done, but it is a lot of extra work.

If this is not a problem on Linux, it worked before on Windows and
printf supports this feature, I would say this is a bug.

I have raised this as a bug:
http://bugzilla.gnome.org/show_bug.cgi?id=143037

Regards,
Martyn



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