doy / package-stash-xs

faster and more correct implementation of the Package::Stash API
4 stars 3 forks source link

Wrap assignment in parentheses #2

Closed jacquesg closed 10 years ago

jacquesg commented 10 years ago

Fix a clang warning.

doy commented 10 years ago

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.

jacquesg commented 10 years ago

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)) {
        ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~