3 ms·
In C, == simply produces a numeric value (0 or 1). There's nothing "weird" about the subsequent operation of & on those values. There's no effects to make shor
by gsg 12y ago
In C, == simply produces a numeric value (0 or 1). There's nothing "weird" about the subsequent operation of & on those values.
There's no effects to make short-circuiting a problem, either - on the contrary, it is likely that the programmer had branchless code in mind.
- unwind 12y agoBlush. You're right, at least in that == produces 0 or 1. I was sure it had been "ported" to produce _Bool when that was added (which then of course automatically converts to 0 or 1 as needed), but that seems not to be the case. I still think the ANDs should be boolean (i.e. &&) though, but perhaps your hunch about branchlessness is right. Thanks.