我可以控制调试器窗口中浮点和双精度变量变量显示的位数吗? [英] Can I control the number of digits displayed in debugger windows for float and double variables?

查看:94
本文介绍了我可以控制调试器窗口中浮点和双精度变量变量显示的位数吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Visual Studio 2012中,我正在寻找一种自定义自动,本地和监视窗口中浮点类型的默认显示的方法。我对Native Visualizer(Natvis)实用工具很熟悉,但是看不到任何调试器格式化工具可以完成此操作。同样,我不知道有什么方法可以覆盖任何原始类型的默认显示(除了启用十六进制)。

In Visual Studio 2012, I'm looking for a way to customize the default display of floating point types in the Autos, Locals, and Watch windows. I'm familiar with the Native Visualizer (Natvis) utility, but don't see any debugger formatting facilities to accomplish this. Likewise, I'm not aware of any means to override the default display of any primitive types (aside from enabling hex).

目标是使用以下命令创建显示字符串对应于点,几何矢量等的类型扩展的位数减少了,但是当我扩展类型时,仍具有所有精度。因此,例如,我可能将点类型的变量显示为(0.000,1.234,2.429)而不是 m_x = 0.00000000,m_y = 1.234245213。 .. 在汽车窗口的中间列。

The goal would be to create display strings with fewer digits expanded for types corresponding to points, geometric vectors, etc, but still have all the precision show up when I expand the types. So for example I might have a variable of a point type display as (0.000, 1.234, 2.429) instead of m_x = 0.00000000, m_y = 1.234245213... in the middle column of the Autos window.

我在此页面,但看不到控制浮点精度的方法。

I looked through the format specifiers at this page, but don't see a way to control floating point precision.

推荐答案

不幸的是,在C ++调试中,确实没有办法进行这种细粒度的更改。在托管语言中,有可能在某些有限的情况下(当原语是对象的字段并使用特殊的 [DebuggerDisplay] 属性进行注释时)。对于C ++,这种类型的自定义功能根本不存在。

Unfortunately there is really no way to do this fine grained level of a change in C++ debugging. In a managed language it would be possible in some limited scenarios (when the primitives were fields of objects and annotated with special [DebuggerDisplay] attributes). For C++ though this type of customization just doesn't exist.

这篇关于我可以控制调试器窗口中浮点和双精度变量变量显示的位数吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆