Additional Topics > External Development Guide > IDLInternals - Miscellaneous > Macros

# Macros

The macros defined in `idl_export.h` handle recurring small jobs. Those macros not discussed elsewhere in this book are covered here.

## IDL_ABS(x)

IDL_ABS() accepts a single argument of any numeric C type, and returns its absolute value. IDL_ABS() evaluates its argument more than once, so be careful to avoid unwanted side effects, and for efficiency do not call it with a complex expression.

## IDL_CARRAY_ELTS(arr)

This macro encapsulates a common C language idiom for determining the number of elements in a statically defined array without requiring the programmer to provide a constant or otherwise hardwire the length. It’s use improves the robustness of code that uses it by automatically adapting to any change in the definition of the array without requiring additional programmer effort. This macro corresponds directly to the C expression:

sizeof(arr)/sizeof(arr[0])

The C compiler evaluates this expression at compile time, so there is no additional runtime cost for using this macro instead of a hardwired constant.

## IDL_CHAR(ptr)

IDL_CHAR() casts its argument to be a pointer to char. It is used to convert an existing pointer into a generic pointer to a memory location.

## IDL_CHARA(addr)

IDL_CHARA() takes the address of its argument and casts it to be a pointer to char. It is used to get a generic pointer to a memory location.

## IDL_MIN(x,y) and IDL_MAX(x,y)

The arguments can be of any numeric C type as long as they are compatible with each other. IDL_MIN() and IDL_MAX() return the smaller and larger of their two arguments, respectively. These macros evaluate their arguments more than once, so be careful to avoid unwanted side effects, and for efficiency do not call them with a complex expression.

## IDL_ROUND_UP(x, m)

IDL_ROUND_UP() returns the value of x rounded up modulo m. m must be a power of 2. This macro is useful for extending data regions out to a specified alignment.

## IDL_TRUE and IDL_FALSE

When performing logical expression evaluation the C programming language, in which IDL is written, treats zero (0) as False, and non-zero as True, and when returning the result of such an expression, uses 1 for True and 0 for False. IDL_TRUE is defined as the constant 1, and IDL_FALSE is defined as the constant 0. These constants are used internally by IDL.