开发者

Is there a facility in C++ similar to ruby's set_trace_function?

In ruby there is a method on开发者_StackOverflow the Kernel object called set_trace_function. It will execute a given proc object on occasion, when a method is called or returns, or when an exception is raised. You can use this to make your own loggers and learn interesting things about your program &c...

Is there a similar facility in C++ or maybe in boost? Also, what is this facility called in general?

Thanks!

z.


Like Seth said this sort of stuff isn't directly available by the language. In order to do something similar in C++ you have to inject this sort of "monitoring code" into your own code during compilation.

In C or C++ this is often referred to as instrumentation or profiling.
To learn more I suggest you google it.

If what you are looking for instead is a logging or debugging helper framework, then you might want to read this (which is actually the second answer when you google instrumentation):
Instrumentation (diagnostic) library for C++

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜