I canβt remember exactly how C # performs its implicit conversions, but in C ++ the conversion extension is done implicitly. Unsigned is considered to be wider than signed, and this leads to unexpected problems:
int s = 5; unsigned int u = 25;
In the above example, s is crowded, so the value will be something like 4294967295. This has caused me problems earlier, I often have return -1 methods to say βno matchβ or something like that, and with an implicit conversion he just does not do what I think should.
After some time, programmers almost always learned to use signed variables, except in exceptional cases. Compilers these days also generate warnings for this, which is very useful.
Ray Hidayat Jan 29 '09 at 2:01 2009-01-29 02:01
source share