开发者

How to customize watch window formatting

开发者 https://www.devze.com 2023-03-25 16:50 出处:网络
I have a class someth开发者_JAVA技巧ing like: class TimeSpan { ... private: __int64 m_ticks; }; When debugging in VS, TimeSpan variables show up as unreadable huge numbers, and I need to use some k

I have a class someth开发者_JAVA技巧ing like:

class TimeSpan
{
  ...
private:
  __int64 m_ticks;
};

When debugging in VS, TimeSpan variables show up as unreadable huge numbers, and I need to use some kind of utility to make it readable. I would like to be able to see TimeSpan variables in a sensible way in the watch window, like "01:12:43.0000".

Is there a way to do this? How?


You can find information about this here. It also applies to VS2008. It is a bit underground and unstable. Take care !

Another option is to modify your class to include the formatted string and update it in all your non-const method.

class TimeSpan
{
  ... 
private:
  __int64 m_ticks;
#ifdef _DEBUG
  std::string m_str;
#endif
}
0

精彩评论

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