The Scope of Preprocessor Directives

Conditional constructs #if , #ifdef , and #ifndef must be contained entirely within a single file.

The scope of the #define directive is limited to a header file in which this directive resides plus all files that include this file with the (#) include , #includeb , or (#)includepp directives.

A #define directive placed in a source file is only visible in this source file.

Scope of #define directives placed in your source and header files

Like variable defines or declarations, preprocessor identifiers created with the #define directive are visible from the line where they are defined onwards.

Unlike variables, the scope of a preprocessor identifiers always extends to the bottom of a file (or to the bottom of all files that include this file).

There are no local scopes and sub-scopes for preprocessor definitions. Here is a code example:

** Tibbo Basic **

sub on_sys_init
   dim f as byte
   for f=0 to 10
      dim s as string      'this variable's scope is limited to the for-next loop it resides in
      #define NUM_ITEMS 10 'this macro is visible from here to the end of the file
   next f
end sub

Scope of preprocessor identifiers defined in the Customize Project dialog

Global preprocessor identifiers (from the Customize Project dialog ) are visible everywhere in your project.