Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: operator precedence related to poll #447

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mtasaka
Copy link

@mtasaka mtasaka commented May 28, 2024

Fixes the following warnings:

connect.c:162:19: warning: suggest parentheses around comparison in operand of ‘&’ [-Wparentheses]
mailstream_ssl.c:368:32: warning: self-comparison always evaluates to false [-Wtautological-compare]
mailstream_ssl.c:368:32: warning: suggest parentheses around comparison in operand of ‘&’ [-Wparentheses]

Fixes the following warnings:

```
connect.c:162:19: warning: suggest parentheses around comparison in operand of ‘&’ [-Wparentheses]
mailstream_ssl.c:368:32: warning: self-comparison always evaluates to false [-Wtautological-compare]
mailstream_ssl.c:368:32: warning: suggest parentheses around comparison in operand of ‘&’ [-Wparentheses]
```
@mtasaka
Copy link
Author

mtasaka commented May 28, 2024

Since C operator precedence says != is higher than & , the code

if (pfd.revents & POLLOUT != POLLOUT)

is interpreted as

if (pfd.revents & (POLLOUT != POLLOUT) )

... which is always false because POLLOUT != POLLOUT is always evaluated as 0. I don't think this is intended.

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.

1 participant