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

[bug] Operations such as "|=", "&=" and "^=" lack necessary implicit type conversions #399

Open
onlytheworld opened this issue Apr 13, 2024 · 0 comments

Comments

@onlytheworld
Copy link

Operations such as "|=", "&=" and "^=" lack the necessary implicit type conversions, e.g. the following code will compile with the error "op requires the same type for all operands and results".

void setbit(char *set, int number, int value)
{
        set += number / CHAR_BIT;
        if (value)
                *set |= 1 << (number % CHAR_BIT);           /* set bit  */
        else    *set &= ~(1 << (number % CHAR_BIT));        /* clear bit*/
}
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

No branches or pull requests

1 participant