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)");


M.



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