Signed and Unsigned Types (MIDL)

Compilers that use different defaults for signed and unsigned types can cause software errors in your distributed application. You can avoid these problems by explicitly declaring your character types as signed or unsigned. Note that DCE IDL compilers do not recognize the keyword signed. Therefore, this feature is not available when you use the MIDL compiler /osf switch.

MIDL defines the small type to take the same default sign as the char type in the target C compiler. If the compiler assumes that char is unsigned, small will also be defined as unsigned. Many C compilers let you change the default as a command-line option. For example, in the Microsoft Visual C++ development environment, the /J command-line option changes the default sign of char from signed to unsigned.

You can also control the sign of variables of type char and small with the MIDL compiler command-line switch /char. This switch allows you to specify the default sign used by your compiler. The MIDL compiler explicitly declares the sign of all char types that do not match your C-compiler default type in the generated header file.