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

Wrap assignment in parentheses #2

Closed
wants to merge 1 commit into from
Closed

Wrap assignment in parentheses #2

wants to merge 1 commit into from

Conversation

jacquesg
Copy link

Fix a clang warning.

@doy
Copy link
Owner

doy commented May 10, 2014

No, that's not how C works. "if you could assign the result of hv_fetch_ent to slot" is a nonsensical concept - regardless of the parentheses involved, an assignment expression returns the value of the value assigned, and an if statement tests the truth value of that, not "whether the assignment could work". If you're running into an actual problem here though, I'd be more than willing to look at a failing test.

@doy doy closed this May 10, 2014
@jacquesg
Copy link
Author

This was to fix a warning.

XS.xs:601:14: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
    if (slot = hv_fetch_ent((HV*)SvRV(self), name_key, 0, name_hash)) {
        ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

doy added a commit that referenced this pull request Jul 4, 2014
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.

2 participants