swirl Guide to OmniMark 5   OmniMark home
docs home 
IndexConceptsTasksSyntaxLibrariesOMX VariablesErrors
 
  Related Syntax   Related Concepts  
declaration/definition   include-guard    

Syntax

  include-guard name

Where:
name



Purpose

Prevents a file from being included twice, and thus prevents the file from being processed twice.

Sometimes it's desirable to write include files that themselves include other files. However, this can mean that the same file could get included twice, and therefore processed twice, which will almost certainly produce compile-time errors or other undesirable consequences.

To prevent an include file from being processed twice, use an include-guard declaration at the top of each include file you write. The include-guard declaration consists of the keyword include-guard followed by any valid OmniMark name. We suggest using the filename of the include file itself as the include-guard name:

  include-guard myfile.xin

The OmniMark compiler maintains a list of include-guard names as it compiles your program. If it encounters an include-guard name it has already seen before, it ignores the rest of the file in which the include-guard occurs. This ensures that an include file is never processed more than once.

All OmniMark-supplied include files have include-guard declarations.

    Related Syntax
   include
 
Related Concepts
   Including code from other files
   Rule-based program, basic structure
 
----

Top [ INDEX ] [ CONCEPTS ] [ TASKS ] [ SYNTAX ] [ LIBRARIES ] [ OMX ] [ OMX ] [ ERRORS ]

Generated: August 11, 2000 at 3:07:21 pm
If you have any comments about this section of the documentation, send email to docerrors@omnimark.com

Copyright © OmniMark Technologies Corporation, 1988-2000.