Skip to main content

All Questions

Advice
1 vote
7 replies
154 views

The conditional ? : operator in Java is right-associative. So the expression a<b ? c<d ? 1 : 2 : 3 ; is evaluated as a<b ? (c<d ? 1 : 2) : 3 ; Does this mean that the expression (c<d ?...
Sebastian Mueller's user avatar
1 vote
1 answer
223 views

I've been struggling to understand why this returns 252448 instead of 251248. <?php $a = 4; echo ++$a * $a++ . $a += $a . $a *= 4; ?> My thinking is: ++$a * $a++ gives 25 (5*5), after that we ...
Sergiusz Strzelczyk's user avatar
58 votes
1 answer
5k views

In C and C++, the expression some_num & 0xABCD == 5 will effectively evaluate as some_num & (0xABCD == 5). This is unlike all of the standard arithmetic operators, as they have higher ...
bhfelliot's user avatar
  • 667
4 votes
2 answers
258 views

This code doesn't compile. It seems like the compiler (VS) is interpreting the expression as: (std::cout << ul1) & (ul2 << std::endl) #include <iostream> int main() { ...
user8683582's user avatar
1 vote
1 answer
75 views

I am a PowerShell novice. Suppose that I wish to call Get-Service -Name winrm, netlogon Due to parameter binding, this will be parsed as if we typed @("winrm", "netlogon") rather ...
J. Mini's user avatar
  • 1,746
1 vote
0 answers
145 views

I encountered with this problem while reading about Precedence climbing and Pratt parsing. This may be duplicate with this QA but that doesn't say much about Precedence climbing and Pratt parsing. The ...
An5Drama's user avatar
  • 774
1 vote
1 answer
87 views

I checked python operator precedence (This one grammar is more detailed and more appropriate for the actual Python implementation) Operators in the same box group left to right (except for ...
An5Drama's user avatar
  • 774
-1 votes
1 answer
115 views

Why am I getting the output as 15 and not 10 for the following code? class Main { public static void main(String[] ARGS){ int x = 10; x += (x=5); System.out.println(x); ...
BALAJI S's user avatar
6 votes
2 answers
252 views

I have just started learning about pointers in C and was using a pointer p to iterate through the elements of an array. My goal was to increment every element by one, but after applying the increment ...
Bruno Fernandes's user avatar
0 votes
1 answer
40 views

Python yields different answers >>> 0 < 0 == 0 False >>> (0 < 0) == 0 True >>> 0 < (0 == 0) True is this a bug? Python 3.11.10 (main, Sep 7 2024, 18:35:41) [GCC ...
MrJ's user avatar
  • 1,524
0 votes
0 answers
48 views

My understanding is that the order of operations happens left to right in c, unless there's an operation that takes precedent (like multiplication happens before addition). int i = 3 * 2 + 4; //i == ...
Badasahog's user avatar
  • 1,025
1 vote
2 answers
94 views

I have a specific example in mind. x = a +++ b; This is evaluated as a++ not ++b. But I don't understand if this is due to order of precedence of postfix being higher than prefix, or due to order of ...
Salma Ihab Hamed's user avatar
1 vote
2 answers
83 views

I was searching in the python documentation in order to get the 'Precedence table' of the operators in python, here it is (at least for python 3.12.7), Section 6.17: https://docs.python.org/3.12/...
proprogrammer's user avatar
0 votes
2 answers
88 views

I have these two code snippets that are acting differently: int i=2,j=3; if (j*=i == 2){ printf("yes, i= %d, j= %d",i,j); } else { printf("no, i= %d, j= %d",i,j); } int i=...
tariqalr's user avatar
4 votes
3 answers
169 views

I'm trying to understand why this expression: $x = false && print 'printed' || true; results in $x being false instead of true. I know that && has higher precedence than ||, but I'm ...
Mohammed Ayesh's user avatar

15 30 50 per page
1
2 3 4 5
124