KEMBAR78
AGS: Fix Windows build failing to compile by elasota · Pull Request #4957 · scummvm/scummvm · GitHub
Skip to content

Conversation

@elasota
Copy link
Contributor

@elasota elasota commented Apr 29, 2023

Fixes int-bool comparison that is breaking the Windows build.

@digitall
Copy link
Member

@elasota : Couple of nitpicks, could you edit the commit message to remove the trailing fullstop and add the reason for the issue i.e. Window build fails due to this.

Beyond that, I was under the impression that comparing bool to int, while not good style is valid C/C++ syntax.

@digitall digitall requested a review from tag2015 April 29, 2023 22:59
@sev-
Copy link
Member

sev- commented Apr 29, 2023

Thanks!

@sev- sev- merged commit 5c5b456 into scummvm:master Apr 29, 2023
@elasota
Copy link
Contributor Author

elasota commented Apr 29, 2023

Beyond that, I was under the impression that comparing bool to int, while not good style is valid C/C++ syntax.

It is valid but it was promoted to an error because it is usually a mistake. Comparing a bool to an int does not coerce the int to bool by comparing it to zero, it coerces the bool to the scalar type and compares it as an integer, meaning it will only compare true if the int value is equal to the integer value of "true" (which is usually 1, but is actually implementation-defined, which is one more reason to not do this).

@tag2015
Copy link
Contributor

tag2015 commented Apr 29, 2023

Thanks for the fix! Among all the commits from upstream I didn't spot this misleading constuct :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants