Re: [Vala] How to check if string is empty



My mistake. Thanks for correcting me.

17.01.2017, 10:55, "Jens Georg" <mail jensge org>:
 In Vala you can simply just check for str != "", this is enough.

No, if str is nullable it's semantically different, because str != ""
will be generated as

if (g_strcmp0 (_tmp1_, "") != 0) {
   ..
}

This will be TRUE for _tmp1_ being NULL because NULL isn't "" ( and
g_strcmp0 will return -1 because NULL is < everything)
so if str is nullable, str != "" means NULL or not empty.
_______________________________________________
vala-list mailing list
vala-list gnome org
https://mail.gnome.org/mailman/listinfo/vala-list


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