swirl
Guide to OmniMark 7   OmniMark home
docs home 
IndexConceptsTasksSyntaxLibrariesLegacy LibrariesErrors
 
  Related Syntax   Related Concepts  
declaration/definition  

include-guard

 
 

Syntax

  include-guard name

Argument definitions

name
Any valid OmniMark 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 ] [ LEGACYLIBRARIES ] [ ERRORS ]

OmniMark 7.1.2 Documentation Generated: June 28, 2005 at 5:45:20 pm
If you have any comments about this section of the documentation, send email to [email protected]

Copyright © Stilo Corporation, 1988-2005.