Q1. In Java, all objects, arrays and class variables are stored on the heap? Is the same true for C++? Is data segment a part of Heap?
What about the following code in C++?
class MyClass{
private:
static int counter;
…
How can I access the local variables of a super class method in an overridden method in the subclass?
class Foo(object):
def foo_method(self):
x = 3
class Bar(Foo):
def foo_method(self):
super().foo_method()
…
Java stack create new frame for every method call, But does this frame takes memory on the stack?
To clarify on my question :
public void oneWay()
{
System.out.println("start");
get1();
}
private void get1()
{
System.out.println("get1");
…
In dotNet a line throws an exception and is caught, how can I figure out which line in which file threw the exception? Seems relatively straightforward, but I can't figure it out...
Printing the stack trace is not so difficult when using System.Diagnostics. I am wondering if it is possible to print the VALUES of the parameters passed to each method up the stack trace, and if not why not.
Here is my preliminary code:
public…
The Smalltalk object thisContext look strange and marvelous. I can't understand what it is and how it works. And even how it enables continuations.
For C's call-stack, I can easily imagine how is it implemented and working. But for this... I can't.…
Hello i am trying to figure out how does stackalloc work.So coming from C/C++ from my knowledge (limited) you can not allocate memory on the stack dynamically like in here:
C/C++ example:
void Allocate(int length){
int vector[length]; …
I'm trying to find out if it's possible to resolve variables in stack frames (as returned by inspect.currentframe()).
In other words, I'm looking for a function
def resolve_variable(variable_name, frame_object):
return…
I'm having trouble understanding the differences between stack frames and execution frames, mostly with respect to the traceback and inspect modules (in Python 3).
I thought they were the same but the docs imply they are not as methods of the…
I am just learning Assembler and debugging skills in OllyDbg in order to learn how to use undocumented functions. Now I am having the following problem:
I have the following code part (from OllyDbg):
MOV EDI,EDI
PUSH EBP
MOV EBP,ESP
MOV EAX, DWORD…
I have a question about this on testing the following code:
1,
def file_close_test():
f = open('/tmp/test', 'w+')
if __name__ == '__main__':
file_close_test()
# wait to see whether file closed.
import time
time.sleep(30)
2,
def…
The Go code is here:
package main
func add(a, b int) int {
sum := 0
sum = a + b
return sum
}
func main() {
println(add(1, 2))
}
The Go version is
$ go version
go version go1.19.1 darwin/amd64
I use the following command to get…
I'm wondering if it makes sense to push the return value of a function in its the stack-frame.
I know return values are mostly stored in registers (eax for gcc), but is it for performance only?
Thanks!
I'm refactoring a C++ application that refers to a bunch a multiple callback functions, each having a different number of arguments and I would like to know if there's a generic way to build a dedicated argument stack frame before calling each of…