swirl
Guide to OmniMark 9   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
 
Related Concepts
 
 

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

OmniMark 9.1.0 Documentation Generated: September 2, 2010 at 1:51:21 pm
If you have any comments about this section of the documentation, please use this form.

Copyright © Stilo International plc, 1988-2010.