In article <6b02…@news.sunsite.dk>, Arne Vajhøj <ar…@vajhoej.dk> wrote:
>On 11/20/2026 3:24 PM, Arne Vajhøj wrote:
>> On 11/20/2026 3:10 PM, Simon Clubley wrote:
>>> [snip]
>> Doesn't C require/mandate short circuiting in cases like this??
> >I believe the VMS landscape looks like: > > Undefined(*) L to R L to R > all short circuit > [snip] >VMS Fortran .and. > .or. >VMS Pascal and and_then > or or_else >C & && > | || >Ada and and then > or or else >Java & && > | || >Python & and > | or >PHP & && > | || > and(**) > or(**) >[snip]
For C, Java, Python, and (probably?) PHP, you are mixing up different categories of operators: `&` and `|` are bitwise operators in those languages, while `&&` and `||` are boolean operators. Since they are intended to do differnt things, the semantics are different. I doubt that there are many many languages that would introduce short-circuiting behavior for bitwise operators. But note also that we may see behaviors like this: ```c #include <stdio.h> int main(void) { int a = 1, b = 2; if (a) printf("a is true\n"); if (b) printf("b is true\n"); if (a & b) printf("both are true\n"); else printf("but `&` is not a boolean operator\n"); return 0; } ``` Moral of the story: don't lump boolean and bitwise operators together like they are the same thing. - Dan C.