为什么 codevision avr 忽略"if"运算符中的某些语句?
Why codevision avr ignores some statements in "if" operator?
现在它可以正常工作了。当然这是我的错误,但没有你的问题很难解决。
if ((key==11)^(key==13)^(key==16)^(key==17)) //this is the only
// dirty hack style string needed to fix this
{
switch (key)
{
case 11: { mode=0x01; break; } //plus
case 13: { mode=0x02; break; } //minus
case 16: { mode=0x03; break; } //multiply
case 17: { mode=0x04; break; } //divide
}
if (mode)
{
buffer=atof(display);
firstop=1;
first=1;
redraw=1;
//and to delete the goto
}
}
您永远不会重置模式,因此按下一次将继续为任何其他键执行所选模式。
您在切换语句中没有定义默认语句
尝试使用编译器优化开关。如果它解决了您的问题,那么它可能是volatile
问题,其中模式被优化出
相关文章:
- 多个If语句与使用逻辑运算符计算条件的单个语句的比较
- 三元运算符在返回语句中给出意外的结果
- C++使用逗号运算符的多个控制语句
- 当返回语句时,逗号运算符、大括号初始化列表和 std::unique_ptr 组合在一起
- 是否可以在C++中使用三元运算符在 if 语句中选择比较运算符?
- 在同一语句中重载运算符+多次
- 复制构造函数和复制赋值运算符是否应具有相同的语句?
- c++ 如何计算赋值运算符(if 语句)
- 为什么使用 and 运算符比较 if 语句中的 2 个对象会抛出错误,而使用 2 if 语句则不会
- 在返回语句中嵌套条件运算符
- 为什么 if 语句对于运算符重载函数计算 false
- 使用 if (? 运算符) 语句传递带有指针的数组
- 如何在COUT语句中使用移动运算符
- 在 c++ 中,如何修改运算符以便在同一语句中连续调用它两次
- 我们可以在if语句中使用三元运算符
- 如何修复"运算符不匹配=="比较if语句中的字符串时
- 如何像if语句一样使用三元运算符
- 关于手术室 ( || )运算符和返回语句
- 赋值运算符和条件语句
- 返回语句中的C++11显式转换运算符/构造函数