【发布时间】:2011-06-19 21:32:10
【问题描述】:
我有一个二次方程结构,我想让它在 Visual Studio 2008 调试器中看起来更好。这是结构:
struct QuadraticEquation
{
float squareCoefficent; float linearCoefficent; float yIntersection;
}
我希望它在调试器中显示为格式正确的公式:
3.0x^2 - 1.3x + 6.5
这是 autoexp.dat 预览脚本:
QuadraticEquation{
preview
(
#if($c.squareCoefficent != 0.0f)
(
#($c.squareCoefficent, "x^2")
)
#if($c.linearCoefficent < 0.0f)
(
#(" - ", -$c.linearCoefficent, "x")
)
#elif($c.linearCoefficent > 0.0f)
(
#(" + ", $c.linearCoefficent, "x")
)
#if($c.yIntersection < 0.0f)
(
#(" - ", -$c.yIntersection)
)
#elif($c.yIntersection > 0.0f)
(
#(" + ", $c.yIntersection)
)
)
}
非常直接。但是当我运行代码时,我收到以下错误消息:
ERROR! Autoexp.dat:line(286) for 'QuadraticEquation': Failed to match ')' for preview/children rule
行号对应于第二个#if 分支,从#if($c.linearCoefficent < 0.0f)... 开始
如果我删除除平方系数分支之外的所有内容,它不会出错。如果这意味着我不能有顺序的#if 块,我还能怎么做我想做的事——而不放入 dll 中?
【问题讨论】:
标签: c++ visual-studio visual-studio-2008 visual-c++ debugging