There is no standardized interface to add an additional message to assert errors. A portable way to include one is to use a comma operator provided it has not been overloaded

This commit is contained in:
Patricia Aas 2021-09-10 15:33:13 +02:00
parent b3480111db
commit 32a27e986e
2 changed files with 2 additions and 2 deletions

View File

@ -43,7 +43,7 @@ Position Inky::target(const GameState & gameState) const {
targetPosition.y += 2;
break;
case Direction::NONE:
assert(false && "Pacman should be moving!");
assert(("Pacman should be moving", false));
break;
}

View File

@ -43,7 +43,7 @@ Position Pinky::target(const GameState & gameState) const {
targetPosition.y += 4;
break;
case Direction::NONE:
assert(false && "Pacman should be moving!");
assert(("Pacman should be moving", false));
break;
}
return gridPositionToPosition(targetPosition);