Re: g_log () with NULL arg crashes on Win32
- From: mortenw gnome org (Morten Welinder)
- To: gtk-devel-list gnome org
- Subject: Re: g_log () with NULL arg crashes on Win32
- Date: Fri, 21 May 2004 17:04:54 -0400 (EDT)
> 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]