Re: [Vala] How to check if string is empty
- From: Jens Georg <mail jensge org>
- To: vala-list gnome org
- Subject: Re: [Vala] How to check if string is empty
- Date: Tue, 17 Jan 2017 09:54:49 +0100
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.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]