Argument promotion
The C compilers that accept Kernighan--Ritchie (K&R) syntax promote all arguments to the int data type when they are passed to a routine.
The size of this int data type is native for the
computer architecture. ANSI C compilers permit arguments to be shorter
than the native computer architecture size of an int. However,
the routine manager uses K&R calling conventions when it pushes
an MI_DATUM value onto the thread stack.
Tip: Many
ANSI C compilers can use K&R calling conventions so code does
work correctly across all platforms.
The routine manager cast promotes arguments with passed-by-value
data types whose sizes are smaller than the size of the MI_DATUM data
type to the size of MI_DATUM. When you obtain the smaller passed-by-value
data type from the MI_DATUM structure, you must reverse the
cast promotion to assure that your value is correct. For more information,
see MI_DATUM in a C UDR (Server).
Tip: To avoid this
cast-promotion situation, the BladeSmith product generates C source
code for BOOLEAN arguments as mi_integer instead of mi_boolean.
If you pass an argument smaller than an MI_DATUM structure, it is recommended that you pass a small “by-value” SQL type as an mi_integer value.