Next: Coding for Mule, Previous: Adding Global Lisp Variables, Up: Rules When Writing New C Code [Contents][Index]
Avoid using unsigned int
and unsigned long
whenever
possible. Unsigned types are viral – any arithmetic or comparisons
involving mixed signed and unsigned types are automatically converted to
unsigned, which is almost certainly not what you want. Many subtle and
hard-to-find bugs are created by careless use of unsigned types. In
general, you should almost never use an unsigned type to hold a
regular quantity of any sort. The only exceptions are
Other reasonable uses of unsigned int
and unsigned long
are representing non-quantities – e.g. bit-oriented flags and such.