> > > As to the gboolean==TRUE/FALSE, Technically I don't think it matters
> unless
> > > someday glib decides to change it's #defs.
> > > But I can change it for readabilities sake.
> >
> > I was partially wrong. You should not do == TRUE but == true is fine.
>
> FALSE equals 0, so using ternary operator is fine. The only dangerous op is
> `gboolean_var == true ?`, which is never true.
bool_test == true -> true // 42 is converted to true at assignment time
g_test == TRUE -> false
g_test == FALSE -> false
bool(g_test) -> true
if statements and assignment to bool will implicitly cast the gboolean to a bool. This uses the standard definition for true and false, and as such, a value like 42 is considered true.
If you feel like you really must check for a value, please check for FALSE, or != FALSE. This is the only true safe way to check an integral value for "true".»
Btw in this case the function returns a gboolean so there is no problem at all.
> > > As to the gboolean= =TRUE/FALSE, Technically I don't think it matters
> unless
> > > someday glib decides to change it's #defs.
> > > But I can change it for readabilities sake.
> >
> > I was partially wrong. You should not do == TRUE but == true is fine.
>
> FALSE equals 0, so using ternary operator is fine. The only dangerous op is
> `gboolean_var == true ?`, which is never true.
From https:/ /lists. launchpad. net/unity- dev/msg00231. html
«bool bool_test = 42;
gboolean g_test = 42;
bool_test == true -> true // 42 is converted to true at assignment time
g_test == TRUE -> false
g_test == FALSE -> false
bool(g_test) -> true
if statements and assignment to bool will implicitly cast the gboolean to a bool. This uses the standard definition for true and false, and as such, a value like 42 is considered true.
If you feel like you really must check for a value, please check for FALSE, or != FALSE. This is the only true safe way to check an integral value for "true".»
Btw in this case the function returns a gboolean so there is no problem at all.