209 questions
22
votes
1
answer
746
views
Why can the reference to the std::array be evaluated first when assigning to it using a brace enclosed list?
Running the following code:
#include <array>
#include <iostream>
using namespace std;
array<int, 2> a;
array<int, 2>& f() {
cout << "f" << endl;...
0
votes
1
answer
52
views
Triggers execution order inside transaction for change tracking
I have a Firebird table Orders with bunch of columns. I have after update triggers that log table information in events_history table in the following manner:
SET TERM ^ ;
CREATE OR ALTER TRIGGER ...
0
votes
1
answer
107
views
Storing the recursive call result in a variable leads to incorrect calculation in a DP memoized solution
Just by using the commented code instead of making the recursive calls inside the max function, leads to incorrect result particularly with the following test case
int main() {
Solution obj = ...
5
votes
1
answer
145
views
What is the order of evaluation of VLA dimensions?
Is the following code:
#include <stdio.h>
void case1(int array[][printf("hello ")][printf("world ")]) {}
int i = 0;
void case2(int array[][i++][i++]) {}
int main(void) {
...
-2
votes
1
answer
96
views
Is there any intuitive reason why SQL syntax is handled in this order? [closed]
When SQL handles a query's order of operations it begins at the 'FROM' part. Therefore, a question that can be asked is: why are queries not entered as 'FROM mytable SELECT *;' but instead as 'SELECT *...
0
votes
1
answer
61
views
Problem with Execution order i would guess
im loosing my mind! I try to get data from a form and pass it to a php script that puts the data in a csv file and into a database. This Works, however i am trying to validate the Transmission of the ...
2
votes
1
answer
69
views
Order of evaluation of function in Haskell – call to ++
I'm new to Haskell and don't get how the following function is evaluated:
test1 1 ls = ls
test1 p ls = test1 (p - 1) ls ++ [p]
By the simple scheme below I assumed the answer should be [3, 2],...
2
votes
0
answers
40
views
Any advantage to switching between dtypes before/after non-streaming operations in Polars (for larger than memory data)?
Is there any advantage to switching dtypes during your process? Such as:
str -> categorical (mem saving) -> str (operation) -> categorical in order to make a non-streaming operation fit into ...
1
vote
2
answers
224
views
Does a 2's complement with increment violate order of execution rules in c++17 but not c++14?
This is probably "c++ 101" level question but there is some associated pain so I will ask for comments to be confident.
I have some legacy code to support going back to c++11 and before with ...
5
votes
2
answers
167
views
Am I interpreting C order of operations correctly here?
I was puzzled by the fact that CPPReference says that postincrement’s value evaluation is sequenced before its side-effect, but preincrement has no such guarantee.
I have now come up with an example ...
4
votes
1
answer
129
views
Order of execution is different in different compilers [duplicate]
This code gives different outputs in XCode and in Visual Studio:
#include <iostream>
using namespace std;
int f() {
cout << 'A';
return 1;
}
int main() {
cout << '.' &...
0
votes
1
answer
80
views
Concatenate String and Is Operator
I do not understand why this code does throw a nullref.
I think it has something to do with the priority of the 'plus' operator and the 'is' operator but I am really not sure why.
return "...
-4
votes
1
answer
68
views
Interesting XOR expression evaluation in javascript
Tried out the expression a ^= b ^= a ^= b with a and b taking values 3 and 5 respectively. When executed in Javascript the answer is a = 0 and b = 5, but when run in C the variables got reversed to a =...
1
vote
1
answer
433
views
Why do dictionaries in Python check for a key-existing during assignment?
So I heard that dict instances in Python will check if a key already exists before assigning a value. This seems very redundant to me, and I will explain why with an example.
EXAMPLE:
if(key in ...
2
votes
1
answer
190
views
Different results obtained when using MSVC compiler and GCC compiler
I have this simple little code:
#include <iostream>
int Add (int x, int y) {
std::cout << "In Add(), received " <<x<< " and " <<y<< "\...