Ulrich Eckhardt ha scritto:

> You mean 'function that called the Trace function' and not 'function that
> was called', right?

Yes I mean it... excuse me for my explaination :)

 > The typical solution for this is to create a macro that does the
job, e.g.
> like this:
>
>   #define TRACE(fmt, arg) Trace( "%s: "fmt, __FUNCTION__, arg)

I think that's enough, but the following is an interesting argument.

> If you need to use a variable number of arguments, this becomes a bit more
> tricky. IIRC, C99 introduces macros with a variable number of arguments,
> but I'm not sure about the syntax. Otherwise, in C++, you can use a
> temporary object:
>
>  struct tracer {
>    tracer( char const* file) { ... }
>    void operator()( char const* fmt, ...) const { TraceV(...); }
>  };
>  #define TRACE tracer(__FUNCTION__)

I will try that solution :)
Tnx

_______________________________________________
help-gplusplus mailing list
help-gplusplus@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to