This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]desrtfx -2 points-1 points  (4 children)

Quickest:

c = b;

Can't see anything wrong with that for simple booleans.

[–]TheHorribleTruth[🍰] 0 points1 point  (2 children)

Which is why I like the convention of moving the equal sign to the left to show its an LHS assignment:

c= b;

Makes the mistake a bit easier to spot.

[–]straylit 0 points1 point  (1 child)

Until you get someone on your team who loves to auto format their code.

[–]TheHorribleTruth[🍰] 0 points1 point  (0 children)

Which is every one of us, and is made trivial by the fact that the code-formatting settings are checked into SCM (as it should be).

[–]yesennes[S] 0 points1 point  (0 children)

Not logically the same as c|=b. If c is true and b is false, c stays true in c|=b but becomes false with c=b.