为什么会出现此警告?如果我检查边界,这不是一个真正的假设.以及如何解决?
如果num_actions_to_skip设置为1而不是2,则错误消失.
谢谢
error: assuming signed overflow does not occur when assuming that (X - c) <= X is always true [-Werror=strict-overflow]
cc1plus: all warnings being treated as errors
Run Code Online (Sandbox Code Playgroud)
上 if (loc >= 0 && loc < action_list.count()) {
const QList<QAction *> &action_list = tool_menu->actions();
static const int num_actions_to_skip = 2;
const int loc = action_list.count() - num_actions_to_skip;
if (loc >= 0 && loc < action_list.count()) {
tool_menu->insertAction(action_list.at(loc),
action);
}
Run Code Online (Sandbox Code Playgroud)
它始于
Q_ASSERT_X(i >= 0 && i < p.size() …Run Code Online (Sandbox Code Playgroud)