Suppose I have:
func1()
{
int var = something;
func2(var); /* Call func2() with var as I/P parameter */
......
......
}
func2 (int var)
{
.....
}
We can use __FUNC__ to print the name of func2 in traces.
But is there any way to print (inside f2()) the variable NAME used in the calling function (i.e. f1()) to call this function:
Something in traces (inside f2()) like:
func2(var)
Well, you could modify the function to stringify the input:
However, this can quickly turn rather messy unless you take very good care of how and where you define your methods 🙂