idtypes.idl is used to provide static type checking for all types, including intrinsic types such as int, float, short, double. This is basically a type-safe typedef. Let’s say you're using a LONG to represent a user ID. Ordinarily, you'd just use the LONG data type in all your APIs. This isn't type safe because someone can pass in *any* LONG value -- and not necessary a user ID. To create a new type for user ID, add to this your IDL:


Now use USERID_LONG as your type in IDL or C/C++. It's just as efficient as using a LONG but the compiler will complain unless the client passes in a USERID_LONG.

This page is an example of Catching defects with Patterns.

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.