Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 9b07e2b6b21de2fe0c4fe450ed3fc13bdcc93f49
Ticket: 793779ffffffffffffffffffffffffffffffffff
Include source files only once
User & Date: elfring on 2003-08-23 14:58:09
Changes

  1. assignee changed to: "dkf"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    Multiple inclusion of source files can be avoided in compiled 
    programming languages like C++ by preprocessor 
    statements.
    ...
    #if 
    !defined(_my_text_included)
    #include 
    "my_text.h"
    #endif
    ...
    
    The TCL function 
    "source" includes files, too. But there are no preprocessor 
    directives in a scripting language like TCL. Their statements get 
    executed every time.
    The language PHP provides the 
    function "http://de.php.net/manual/en/function.include-
    once.php".
    
    I suggest to add the option "-once" to avoid 
    multiple inclusions of TCL code.
    
    ...
    if 
    {_my_text_included == 0} \
     {
      source "my_text.h"
     
    }
    ...
    # Write just one line to achieve the same as before 
    with more safety
    source -once "my_text.h"
    
  4. foundin changed to: "None"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "elfring"
  9. subsystem changed to: "18. Commands M-Z"
  10. title changed to: "Include source files only once"
  11. type changed to: "RFE"