[Vala] Unexpected behaviour with uninitialized variables
- From: Nor Jaidi Tuah <norjaidi tuah ubd edu bn>
- To: <vala-list gnome org>
- Subject: [Vala] Unexpected behaviour with uninitialized variables
- Date: Wed, 22 Jun 2011 14:08:09 +0800
Consider this declaration:
Cancellable c;
and somewhere else, before c is
initialized, there is this call:
c.cancel ();
Guess what will happen?
Expectation:
1- best: compiler detects this.
2- acceptable: crashes.
3- acceptable: runtime error messages (like in gtk).
What actually happens:
The program continues running, hiding the bug,
puzzling the programmer as the application slows
down due to async processes consuming the cpu.
The fault is partly due to glib.
Perhaps "g_cancellable_cancel(null)" makes sense,
but "null.cancel()" simply doesn't.
Any chance of vala compiler (or vapi) helping here by
asserting non-null before passing to glib functions?
hand
Nor Jaidi Tuah
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]