Variable Name Limitations

In general, users are free to select any syntactically correct names for variables used within process models. A minor limitation on this is presented by the C/C++ language and most workstation linkers, however. In the C/C++ language, if a global or local variable has the same name as a function, then statements invoking the function will actually resolve to the variable, instead of the intended function’s code. Thus, when statements attempt to invoke such a function, the program starts executing whatever bytes it finds starting at the variable’s address as if it were a function, usually leading to a program abort via illegal instruction.

The above problem does not manifest itself in process model state variables, due to the way they are preprocessed into data structure references. However, process model temporary (local) and header block (global) variables can override function names, so care must be taken not to choose variable names which have the same names as functions.

The most common way in which the name overriding problem occurs is not due to user-defined variable names conflicting with user-defined function names. Instead, user-defined variable names conflict with short system call function names that the user is not even aware are being linked into the simulation. The most likely “conflict list” of function names appears in Table 2; users should avoid duplicating these names for use as variables.

Note: The function names in Table 2 represent only a subset of possible conflicting function names. For a complete list, refer to the Linux manuals or to a Windows API reference.

Table 2: Possible Function Name Conflicts

  • accept()
  • access()
  • audit()
  • bind()
  • clear()
  • clock()
  • close()
  • connect()
  • exit()
  • index()
  • kill()
  • link()
  • listen()
  • open()
  • pipe()
  • poll()
  • read()
  • select()
  • send()
  • signal()
  • socket()
  • stat()
  • tell()
  • truncate()
  • unlink()
  • wait()