Assigning functionTag Names
The function declaration macros take a functionTag parameter (in quotes) to uniquely identify every traceable function. The tag appears in the trace output, so you can quickly find the function that generated a particular message.
Function names with special characters. The
functionTag parameter must be a valid C++ identifier, so you need some convention to handle functions with characters that are invalid in C++ identifiers.
Table 4 shows the convention used throughout Threads Module. You are not required to follow this convention in your code.
Table 4 – Conventions for functionTag parameters
Function Name | Suggested Trace functionTag |
ClassName::ClassName() (constructors) | "ClassName_ctor” |
ClassName::~ClassName() (destructor) | "ClassName_dtor” |
ClassName::operator==() | "ClassName_opEQ” |
ClassName::operator!=() | "ClassName_opNE” |
ClassName::operator<() | "ClassName_opLT” |
ClassName::operator<=() | "ClassName_opLE” |
ClassName::operator>() | "ClassName_opGT” |
ClassName::operator>=() | "ClassName_opGE” |
ClassName::operator=() | "ClassName_opAssign” |
ClassName::operator>>() | "ClassName_opExtract” |
ClassName::operator<<() | "ClassName_opInsert” |
ClassName::operator()() | "ClassName_opFunctionCall” |
ClassName::operator Type() | "ClassName_opType” |
The limitation of functionTags to be valid C++ identifiers stems from the fact that some shells (ksh in particular) do not permit the creation of environment variables that do not follow C++ identifier conventions.
Overloaded functions. This functionTag convention overloads tags. For example, all constructors for a class have the same functionTag. If multiple functions have the same functionTag, the single environment variable controls every version of the function. For distinguishing among overloaded functions, extra characters indicating the signature of the function can be included in the tag name. For example, “ClassName_ctor_ic” could be used for ClassName::ClassName(int, char). Because Trace outputs the filename and line number of the location of each trace event, the function that generated a trace event can be determined.