Assigning a negative number to unsigned types
5. Basic Types
Vala has strict typing, but it still allows you to assign negative numbers to uint.
minimal example:
uint a = -18;
print(@"$a\n");//4294967278
What C# does:
error CS0031: Constant value '-18' cannot be converted to a 'uint'
Also, the -Wconversion
flag does not help because vala makes explicit type casts for more strict typing than in C.
guint a = (guint) -18;