pretty.. but we misguide the function calling in some way.. anyway if this group comes with a some other way like inline asm or whatever it would be good learning experience.
--- In [email protected], Thomas Hruska <[EMAIL PROTECTED]> wrote: > > Indika Bandara wrote: > > #define PRINT_FUNC() > > { > > // i am looking for this > > } > > > > void foo(int i, double d) > > { > > PRINT_FUNC(); > > } > > > > void main() > > { > > foo(1, 1.0); > > > > } > > ============================== > > output: > > void foo(1, 1.0); > > ============================== > > > > isn't it nice? ;-) > > __PRETTY_FUNCTION__ is not very useful(i think) > > > > by this way it will be possible to output a stacktrace nicely > > > >> Argument count: no way (except e.g. using a format string as in the > >> printf() family and hoping that the programmer provided a correct > >> format string which exactly resembles the parameters passed to your > >> function). > >> Argument values: could you please give an example of what you're > >> trying to do? The man pages for va_arg gives enough examples to get > >> you started, but to me it sounds as if you have something different in > >> mind, hence the question for an example. > >> > >> Regards, > >> Nico > > Some platforms/OSes have stack trace APIs. Check yours for stack trace > support first before delving into things like assembler/macros/etc. > Usually requires a debug build of sorts. > > I used to use a massive set of macros to trace function calls. They > worked pretty well but generated massive 200MB to 300MB files per > application run. I used them when calling functions: > > #define DEBUG_FUNC2(_FuncName, _Param1, _Param2) do {\ > printf("%s(%s, %s)\n", #_FuncName, #_Param1, #_Param2);\ > fflush(stdout);\ > (_FuncName)((_Param1), (_Param2));\ > } while (0) > > void foo(int i, double d) > { > } > > int main() > { > DEBUG_FUNC2(foo, 1, 1.0); > } > > Something like that...only a lot fancier. > > -- > Thomas Hruska > CubicleSoft President > Ph: 517-803-4197 > > *NEW* MyTaskFocus 1.1 > Get on task. Stay on task. > > http://www.CubicleSoft.com/MyTaskFocus/ >
