Tracing function calls... How?
In C++
if you write like this , class sample; // contructor prints function name entry line no // destructor prints function return line no foo(){ sample s("foo"); ...//foo body } when we execute this it will print "calling foo 1245" "exiting foo 1260" Now can we do the same thing in C by adding only a single line at the start of the function call. ~ik |
You could add a println() or even a macro which will then print out some diagnostics; but maybe I don't properly understand your question.
|
but maybe I don't properly understand your question
Quote:
example. foo(){ sample("foo"); .. .. .. } sample("foo") will print "foo" when the function is called and also returned. basically constructors and destructors function. i am not sure if it is really possible in C. But it is possible in C++. ~ik |
I'm still uncertain because a constructor and destructor are linked to the life of a object not the life of a method (read function).
|
All times are GMT -5. The time now is 10:24 PM. |