1,328 questions
1
vote
1
answer
63
views
Locals() strange behaviour python?
Why does this not work ?
Python 3.11.6 (main, Oct 8 2023, 05:06:43) [GCC 13.2.0] on linux
Type "help", "copyright", "credits" or "license" for more ...
1
vote
1
answer
70
views
How to interpret a get; set; value when debugging step by step in Visual Studio
I'm debugging a program I'm not at all familiar with in Visual Studio 2022.
I am trying to see the value which goes into the NumeroProjet property.
In order to do this, I have put the set; on a new ...
5
votes
1
answer
147
views
Local scope constant as function's default argument
Can function declaration in a function scope have a locally defined constant as default argument?
For example,
void f(int) {}
int main() {
constexpr int c = 1;
void f(int = c);
f();
}
...
0
votes
2
answers
112
views
Automatic initalization of local variables
According to the C standard, the local variables declared in the local scope would carry garbage value until they are explicitly initialized. In contrast to that, if the variable is declared in the ...
-3
votes
1
answer
179
views
Getting an error accessing variables defined in a loop: cannot access local variable 'x' where it is not associated with a value [closed]
My code:
import numpy as np import cv2
cap = cv2.VideoCapture(0) face_cascade = cv2.CascadeClassifier(cv2.data.haarcascades + 'haarcascade_frontalface_default.xml') eye_cascade = cv2....
0
votes
2
answers
39
views
How to consolidate list of inner elements from map into a map with a value of set type
Hello I'm trying to convert a set of bucket notifications defined as follows to a map: sequence structure so I can iterate over the sequence with a dynamic block in my bucket notifications.
...
0
votes
1
answer
78
views
How do I push the result on stack in a subroutine?
org 0x0100
jmp start
; Declare variables
input1: db 0
input2: db 7
input3: db 9
input4: db 1
message1: db 'The value of AX, BX and CX is: '
length: dw 31
start:
; Push output ...
1
vote
1
answer
59
views
Local array variables in Bash 3.0
Intro
In Bash I can instantiate an empty array a using a=(). I can then append elements using e.g. a[${#a[@]}]="new element" where ${#a[@]} gives the number of elements in a. In a Bash ...
6
votes
0
answers
153
views
Why does the inclusion of an inner function that uses a local variable change order of locals
The following prints {'a': 'a', 'b': 'b'}:
def foo(a: str = "a", b: str = "b") -> None:
print(locals())
foo() # Prints {'a': 'a', 'b': 'b'}
Which I'd expect as locals in ...
0
votes
0
answers
22
views
Difference in Output Between Two Similar C++ Codes with Nested Loops and transform
I'm experiencing a strange issue with two similar pieces of C++ code that are supposed to perform the same task but yield different results.
The problem is around the inner loop statement .
While ...
1
vote
2
answers
104
views
How does Java handle memory with regards to homonymous local variables declared inside different not-nested code blocks inside a method?
I'm new to Java and programming in general. I'm currently studying how Java handles variables' memorization and scope. What I've understood is that:
local variables (i.e. variables declared inside ...
0
votes
1
answer
73
views
Get variable stored at specific memory address in Java
I am working with a Java instrumentation framework (DiSL) to profile some code. I am retrieving the values of local variables at various stages of execution, however some of them are only accessible ...
0
votes
1
answer
94
views
Defining a variable inside an if condition and program doesn't enter
In functions in C, I understand that the stack is normally used to store paramaters passed to a function, and for the local variables for the function. I know that this is compiler and platform-...
1
vote
2
answers
204
views
Why can't I declare this local variable in dart?
Why can't I declare a local variable inside a lambda function?
I have this code:
@override
Widget build(BuildContext context)
{
return new Expanded(
child: new Listener(
...
-1
votes
3
answers
89
views
How to calculate a local variable in function_1 and send the result to function_2 without running function_1 every time function_2 is called?
I'm trying to design a card game with a 'shuffle' function and a 'deal' function. The problem I'm encountering is that every time I pass the results of 'shuffle' to 'deal', the cards are shuffled. I'm ...