C# Compiler Detecting Overflow?

Nov 28 2008 11:52 PM

I am passing 0xffff0000 to a DirectX function that takes an int and interprets the int as a color (fully transparent red). The C# compiler says this is an error because it is auto-converting 0xffff0000 to a uint and saying it can't convert the value to an int (which is what the function takes). Is the C# compiler disallowing overflow? This wouldn't be a problem in C/C++ because the function looks at the byte content of the parameter anyway. Is there a solution to this?

By the way, is there a good resource (web or book) where I can find gory C# details like this? Something like Stroustrup's C++ book?

Thanks


Answers (3)