Jump to content
  • 0

IFDEF directive in VectorScript



2 answers to this question

Recommended Posts

  • 0

It is a compiler directive that is common in programming languages. It is actually part of a series of compiler directives- $DEFINE, $IFDEF, $IFNDEF, and $ENDIF.

$DEFINE [macro code] is used as either a boolean flag to the compiler or to define a macro.

You put blocks of code between $IFDEF and $ENDIF directives. If the identifier has been defined to the compiler with a $DEFINE directive, then that code is compiled. Otherwise it is ignored.

$IFNDEF is the same as $IFDEF except that the code is compiled if the identifier is not defined.

$IFNDEF is most commonly used for "warding"- which is the basically the practice of enclosing a code library in an $IFNDEF directive and having a $DEFINE directive inside the code library. This insures that each code library is defined and compiled only once.

$IFDEF is commonly used in "instrumentation"- which is a method of debugging without the use of an interactive debugger.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...