The line of code in C is
x = x |= (1 << 3);
which gives an cppCheck Error: "Expression 'x=x|=1' depends on order of evaluation of side effects"
whereas the line
x |= (1 << 3);
is ok.
I thought
x = x |= (1 << 3);
whould be the same as
x = x = x | (1 << 3);
which is just
x = (x = (x | (1 << 3)));
where actually the outer assignment to x has no effect, meaning the outcome is the same as
x |= (1 << 3);
So what exactly is CppCheck complaining about here?
edit: think it is a duplicate of why j = j++
is or is not the same as j++
which is discussed in the question referred to above.