Oracle® Solaris Studio 12.4: Debugging a Program With dbx

Exit Print View

Updated: January 2015
 
 

Evaluating Unnamed Arguments in C++ Programs

You can define functions in C++ with unnamed arguments. For example:

void tester(int)
{
};
main(int, char **)
{
   tester(1);
};

Though you cannot use unnamed arguments elsewhere in a program, the compiler encodes unnamed arguments in a form that lets you evaluate them. The form is as follows, where the compiler assigns an integer to %n:

_ARG%n

To obtain the name assigned by the compiler, use the whatis command with the function name as its target.

(dbx) whatis tester
void tester(int _ARG1);
(dbx) whatis main
int main(int _ARG1, char **_ARG2);

For more information, see whatis Command.

To evaluate (or display) an unnamed function argument:

(dbx) print _ARG1
_ARG1 = 4