In C and C++ mixing signed and unsigned types in expressions can be tricky since here
void foo(void)
{
unsigned int a = 6;
int b = -20;
(a+b > 6) ? puts("> 6") : puts("<= 6");
}
output could (unexpectedly) be ">6"
due to promotions. b
will be promoted to unsigned.
Do same things happen in C#? Is it also dangerous to mix signed and unsigned in C# expressions?