Texas Instruments MSP50C614 User Manual
Page 342
C– – Compiler
5-42
5.9.4
C– – Directives
C– – has a limited number of directives and some additional directives not
found in ANSI C compilers. The following directives are recognized by the
compiler.
5.9.4.1
#define
This directive is used to introduce 2 types of macros, in typical C fashion:
Without Arguments:
defines a replacement string for a given string
Example:
#define PI 3.1415926535
Every occurrence of the token PI will henceforth be replaced with the string
3.1415926535.
If there is no replacement string, the given string is deemed
defined: this can
be used in conjunction with the #ifdef / #ifndef directives. It is also possible
to
undefine a macro with the #undefine directive.
With Arguments:
The macro name must be immediately followed by a pair of parenthesis,
which introduces the arguments. This is completely compatible with the usual
C definition.
Example:
#define modulo(i,j) (i%j)
Every occurrence of the word modulo followed by an expression in
parentheses will be replaced by (i%j), where i is the first argument in the
parenthesis, and j the second argument. modulo((a*b),c) will thus be replaced
by ((a*b)%c).
5.9.4.2
#undefine
The string following this directive is removed from the list of macros. There is
no warning if the string is not found in the macro list.