Skip to main content
1 vote
2 answers
2k views

When I run this code it print twice 0 but i don't undrestand why after affect the object k to null the value of count still printed 0 but when i delete static before count and execute this program ...
6 votes
4 answers
6k views

I'd like to do some stuffs before main function. I have multiple source files. In each file, there is some work that needs to be done before main. It was no problem in C++, but problematic with C. In ...
-2 votes
1 answer
199 views

Having the scenario of a C++ library where a function does some calculations as it receives a container normally (not always) across multiples calls, and where the function needs to retain an ...
1 vote
1 answer
72 views

I have a nested class that uses static vars to have class wide parameters and accumulators. If I do it as a standalone class it works. If I do a nested class and inherit the standalone class, it works....
7 votes
1 answer
588 views

I'm learning Rust and while doing research on static variables I came across this comment from 2018: Rust requires everything to be thread-safe (even if you're not using threads, the concept of a ...
3 votes
1 answer
173 views

I have a BaseActivity and multiple Activities that extends it. The BaseActivity has a static variable, which makes it shared between descendant Activities (they all share the same instance of it). ...
0 votes
2 answers
92 views

I have a list of names which is static. I want to save it in a an static jaggedArray (to avoid multiple copies of same data). I want to write something like below code public static string[][] ...
2 votes
1 answer
84 views

I have a problem performing several scenarios one by one in unit testing. I'm testing a function, where static variables are used and they store states of variables after previous test scenarios. Is ...
-3 votes
1 answer
94 views

I'm a student who is studying game engine structure. I've been managing shared resources through the Singleton Patterns Manager class while creating game engines. However, as the code got longer, the ...
-1 votes
3 answers
1k views

I don't know when to use a static/non-static variable in a program. package slides; public class Person { String name; int age; boolean isStaff; public Person(String ...
-1 votes
1 answer
58 views

When declaring static thread_local variable, then each thread has a copy of that variable. Imagine a thread then spins another thread, will this variable still be a copy in the nested thread?
0 votes
0 answers
34 views

I have an wildfly with 10 EARs inside /standalone/deployments. Each of these EARs has a lib called "my-lib.jar" on the /lib directory. This Lib has a class called ...
0 votes
0 answers
102 views

Considering the following example: A class named ObjectFactory is defined to manage the creation of several classes. These managed classes should be registered with the factory so that we can create ...
3 votes
0 answers
42 views

I am writing a cryptographic program for my bachelor's. I've been uzing an mpz_t variable for exponentiation with the PBC library. Currently, to avoid running mpz_init on every exponentiation, I only ...
0 votes
2 answers
1k views

I have the following program: #include <iostream> void Init(); struct Foo { Foo() { int *p = new int; // just to make sure Foo's ctor is not a constant expression Init(); ...

15 30 50 per page
1
2 3 4 5
55