DEFINED - An identifier is defined

Language reference ›› Built-in functions ›› Conditional compilation ››
Parent Previous Next

defined-function = DEFINED "(" conditional-identifier | literal-string ")" .

Special built-in function that can be used in conditional expressions ($IF and $ELSEIF directives) as well as in any expression in normal code.


It returns TRUE if <conditional-identifier> is $DEFINE(d) at this point (equivalent to the $IFDEF directive).


In the <literal-string> case, the string may contain "?" and "*" wild-card characters to match more than one symbol.


 …
 // The section below will not generate any code if the processor is not a PIC18,
 // or if the processor's frequency is less than 4 MHz.
 IF NOT DEFINED('PIC18*') AND (FREQUENCY >= 4000000) THEN
 …


See also: DEFINED_VALUE, DECLARED.