开发者

C2143 C2059 errors with terniary operator

bool xHasReached(double tX, double dstX, bool incX) {
return incX ? tX &g开发者_高级运维t; (dstX - (double)EPSILON) : tX < (dstX + (double)EPSILON);}

So I am getting C2143 (missing token) and C2059 (syntax error) errors. I've tried without the semicolon but is still reports the same errors.

I've tracked the bug down to EPSILON #define.


I'll bet you have #define EPSILON 0.0001 ;.

That should have been const double EPSILON = 0.00001;. Macro's are harder to debug, they tend to cause errors when used rather then when defined.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜