How are we doing? Please help us improve Stack Overflow. Take our short survey

Questions tagged [initialization]

Initialization deals with the task of initializing the contents of your data structure. It's a common practice in statically-typed languages.

Filter by
Sorted by
Tagged with
-2 votes
0 answers
16 views

why does changing one instance of a class change another? [duplicate]

task conditions: Queue with minimum support Implement a queue with minimum support. Input data The first line of input data contains the number n — the number of operations with the queue. Each next ...
Михаил Лесс's user avatar
0 votes
0 answers
8 views

Angular APP_INITIALIZER does not work on (Android) mobile phone

I would like my website to load all data (through API calls) before showing the page, as the data is needed by the components. On the internet there is a solution with APP_INITIALIZER, which works ...
bebe böbe's user avatar
-1 votes
1 answer
78 views

Scope of a variable in java

the code and the error As per variable scope m (not initialized) shouldn't be having a value in it, and that's correct, im getting an error for it but when you initialize a variable and then use it in ...
Amritesh Yadav's user avatar
0 votes
2 answers
22 views

Initial Value in modelForm through init

It could be that I'm trying to solve this issue the wrong way. But if someone has a good idea of how to solve this I'm all ears for it. What I want to achieve. I have a model with a Charfield, that I ...
Jonas's user avatar
  • 43
0 votes
0 answers
14 views

How to activate multiple devices with differing Mac addresses in one python code?

I am trying to make a code more efficient by making python code activate multiple devices at once. Currently, this code is being used to run 5 of the same devices, same instructions, but the script is ...
Ariel Larrabee's user avatar
0 votes
0 answers
60 views

Is there a difference in the initialisation of these two arrays?

I wasn't the first first example to compile because for some reason I has in my head that the initialisation values needed to be compile-time known, but that obviously isn't the case. When are these ...
Zebrafish's user avatar
  • 11.8k
0 votes
0 answers
53 views

Final value in Java getting reinitialized? [duplicate]

I have a variable newcat finally declared, however it appears to be changing its value from null to its default assignment, how is this possible? public static class Davido { private static final ...
linker's user avatar
  • 823
-2 votes
0 answers
32 views

non-aggregate type 'vector<int>' cannot be initialized with an initializer list [duplicate]

I can't initialize any vector, array, map or set data types with initial values, also can't set them to equal a list. I have been learning cpp on my own, mostly through codecademy and a bit of youtube ...
Tenzin Platter's user avatar
-1 votes
0 answers
54 views

Initializing a ConcurrentDictionary in a separate task causes a deadlock

I have code in an ASP.Net application that initializes an internal data cache using a ConcurrentDictionary. When I run the code synchronously, it works. But when I change it to run in a separate task, ...
Cleo's user avatar
  • 658
0 votes
1 answer
54 views

How can I get red of this error: LateInitializationError: Field 'currentPage' has not been initialized

I am using late int currentPage; to keep the last page the reader was in. The value of this value is read from shared perefernces through the _loadIndex() method to get the reader back to the last ...
Abushofa's user avatar
-1 votes
1 answer
68 views

std::shared_ptr owned by one class and initialized by another class

I have a class lets say A. Class A has a member variable of type: std::shared_ptr<SomeType> m_dataMemberInA I do not initialize the member in Class A. In a class B I also have a std::shared_ptr&...
JamalNewtron's user avatar
0 votes
1 answer
13 views

Why is my Player property in QuestGUI returning null despite initialization in the Game constructor?

I am implementing an text-based game in C#. In the "Game"-class, I am initializing a player. If this player completes a quest, he would earn some rewards. Therefore, I want to give the ...
the_dev's user avatar
-4 votes
0 answers
30 views

About converting a to a* in initialisation [closed]

Look at the error in terminal I tried to deal with the error but I could not do it. I want that code to be error free. Here product could not be converted into *product while choosing the product. the ...
45_Ramayanam sarayu's user avatar
0 votes
1 answer
28 views

What is the value of a WebAssembly local that has not been set?

If I use local.get to access the value of a WebAssembly local which I have not already set via local.set or local.tee, am I guaranteed to get a specific default value, or is this undefined behavior? ...
Sam Estep's user avatar
  • 13k
0 votes
2 answers
58 views

How can I create an empty instance of class in java or how should I initialize it?

Just like the title I described above. I'm a little confused about how to initialize variables such as an instance of a class or some collections like ArrayList or HashMap, so I tried something below: ...
snow's user avatar
  • 5
0 votes
2 answers
76 views

Is it ok to initialize final member in abstract base class using abtract method?

I wonder whether I could initialze a final field in an abstract base class with the result of an abtract method, which would be implemented by the derived class. I understand that derived ctor would ...
Y.F.'s user avatar
  • 31
-2 votes
0 answers
25 views

How to initialize? Problem: property initializers run before 'self' is available [duplicate]

I am trying to use the UUID of the „thing“ to initialize the „piece“. import SwiftUI struct ContentView: View { let thing1 = thingModel(titel: "nameOfThing1", col: Color.red) ...
plzHelp's user avatar
0 votes
0 answers
27 views

Kafka Producer time out during initTransactions while one broker is down

I'm using Kafka 2.7.0 and I have created kafka producer with Kafka Transaction. But it hangs and timeout while initialializing the Kafka transaction. In my Kafka cluster, I have 3 brokers. public ...
Chathurika's user avatar
1 vote
2 answers
53 views

Initializing variadic-template-constructed tuple of types with constructor requiring an argument

I apologize already having asked a similar question here when I should have modified the question I asked first. I have the class Level which constructor requires an argument. Using variadic templates ...
Astor's user avatar
  • 310
1 vote
2 answers
108 views

What is the name of the initialization used in char a[] = ""?

What type of initialization is the following? char a[] = ""; // ??? (copies array content) char* q = a; // copy-initialization (copies pointer) // EDIT: originally it was `...
OwnageIsMagic's user avatar
-1 votes
1 answer
62 views

int OR int() for initialization to zero in C++

A confusion regarding the concept of using parenthesis '( )' in C++. I found out when we use int() it means, we are calling constructor of "int" data type. And in C++, int() initializes ...
AlexG's user avatar
  • 57
4 votes
1 answer
52 views

Why does copy-initialization fail for a type with a converting construtor, when list-initialization is valid? [duplicate]

Consider the following code // C++ 14. struct A { A(int i) {} }; struct B { B(A a) {} }; int main(){ A a = 5; B b1 = 5; // error B b2 = a; B b3 { 5 }; B b4 = { 5 }; ...
TSs's user avatar
  • 43
-2 votes
1 answer
57 views

C++ variable initializes even though the copy constructor is deleted

The code below works unexpectedly! class CameraBuffer; class CameraBufferAccessor{ friend CameraBuffer; private: CameraBufferAccessor(const int &data, const int &mutex); public: ...
SᴀQɪB M's user avatar
1 vote
2 answers
72 views

Initialize all elements in array to same value within the struct

Foreword - I seem to have a solution, but I am not sure it is correct because I do not understand how compiler handles it. And yes, I performed research, which did not convince me in reliable and ...
Anonymous's user avatar
  • 573
0 votes
1 answer
62 views

Go type constraint that describes mutable struct behavior

I would like to define a generic function where the type constraint describes mutable struct behavior. What I mean by a "mutable behavior", is an interface like this: type Unmarshaler ...
Ryan Clark's user avatar
-1 votes
0 answers
13 views

Odd Python Behaviour when creating two dimensional lists [duplicate]

I was messing around with python and noticed some really bizarre behaviour and I was wondering if anyone could shed some light. It seems like when initializing lists with the [None] * x syntax the ...
Lucas Henry's user avatar
0 votes
4 answers
123 views

Can I assign or return a struct with unassigned elements in C?

In C, using an uninitialized variable is undefined behavior. Including: int x; int y = x; However, suppose I have the following: struct Struct { int a; int b; }; struct Struct s; s.a = 1; ...
user16217248's user avatar
  • 3,227
0 votes
2 answers
61 views

Initialization of HD44780 LCD Display on ATmega32 in C

The Initialization of the HD44780 isnt working. I went through every Step, on the data sheet, but couldnt make any progress. Im operating on a 4-Bit Interface. I used on purpose no libraries, because ...
En99's user avatar
  • 1
1 vote
1 answer
36 views

Can not Initialize Firebase in javascript

I tried to signup in over my html website over live Server (port:5500). All Firebase rules and Web stuff are configured. But the console output of the live server says error in line 19: `(firebase....
LinusNeedTechTips's user avatar
0 votes
1 answer
69 views

setting ListViews, FXML controller load order. (JavaFX)

I'm making a mod manager for a game, and I'm running into issues where I'm trying to call methods, but they cant be called because the controllers havent been initialized in time. I use SceneBuilder ...
Ryan's user avatar
  • 35
0 votes
0 answers
11 views

Kmeans++ (kmeans plus plus) function in R?

I am clusering data with kmeans clsutering and I would like to initialize the centroids by using kmeans++. But I just cannot find a function, except for kmeanspp, which belongs to a package that is ...
Alina's user avatar
  • 1
1 vote
2 answers
56 views

GDB initialize array with contents [duplicate]

I've not found what I am looking for, so I'll formulate my own question. Consider the C-program below char heap[<some-static-size>]; void main() { <this-code-reads-and-writes-to-heap> } ...
Robert's user avatar
  • 175
0 votes
0 answers
29 views

Errors during flutter web app initialization

https://docs.flutter.dev/platform-integration/web/initialization On the above page, there is a detailed description of how the Flutter web app loads, and what the steps are. However, there is no ...
Interact's user avatar
0 votes
0 answers
54 views

Robot Framework Package Initialization

I'm working on a Robot Framework package, and I've encountered an issue with its initialization and usage. I've developed a Robot Framework package named ApppRobotFrameworkApiPackage that is intended ...
Wai Chun Cheng's user avatar
0 votes
0 answers
17 views

run batch tasks concurrently, the tasks still in the initialization status

run 1.15.2 flink session on k8s,In most cases, there is no problem. Sometimes, tasks are initialized continuously, and subsequent tasks are also initialized continuously, I run batch job with 6 ...
zhu's user avatar
  • 1
-1 votes
2 answers
52 views

C++: Curly Braces Initialization Despite Explicit Constructor

I've had a data class (so like a struct in the C sense: a class with only a bunch of properties) that I used to initialize (through an implicit copy constructor, I think) with curly braces initializer ...
AnonA's user avatar
  • 1
0 votes
0 answers
103 views

Where to start a worker thread in Next.js?

I want to start a worker thread in Next.js. Next.js has no main function, so I doubt where to start the worker. The best places I see are in initialization either of: the top-level widget page.tsx (...
porton's user avatar
  • 5,228
0 votes
1 answer
59 views

Is relying on initialization state of PHP properties bad design? [closed]

I've looked far and wide on how to properly check whether a property is initialized in PHP, only to find that it's not recommended, and should be avoided, hence there is no built in is_initialized PHP ...
Adam J.'s user avatar
  • 116
8 votes
0 answers
158 views

Can you initialize a "cv char[]" with a string literal?

The current wording in [dcl.init.string] p1 states: An array of ordinary character type, [...] may be initialized by an ordinary string literal, [...], or by an appropriately-typed string-literal ...
Jan Schultke's user avatar
  • 20.9k
-1 votes
2 answers
45 views

How to initialize private static constant array of the same class C++

I need to make class B to work with graph of related objects of class A. An instance of B contains A by value, and links to linked B objects(array indexes). Array of B must to be private as OOP ...
TomatOgorodow's user avatar
0 votes
0 answers
16 views

Python child initlisation conventions - using multiple parents to calculate properties

I'm interested in using two parent instances to generate results in a child class. The commonality here is that all the class methods/attributes can be defined as some calculation or selection of the ...
Mr G's user avatar
  • 244
2 votes
2 answers
46 views

Possible to initialize a pointer from a value in array of pointers?

I basically want to have a list of functions as an array of function pointers; then I'd like to manage both an index variable into this array, and a pointer variable that would accept values from this ...
sdbbs's user avatar
  • 4,346
1 vote
1 answer
43 views

Unusual initialization of class fields within the class declaration C++

By chance, I discovered that the construct below works. I did not realize that this is possible. #include <iostream> struct A { public: int a; //default constructor A(): a(-10){} ...
one_two_three's user avatar
0 votes
1 answer
38 views

How to ensure code executes in proper order? Flutter

I am getting error LateInitializationError: Field 'sorting' has not been initialized. In my code I need to ensure that build executes after every function in init is done. Init of sorting happens in ...
jon's user avatar
  • 33
1 vote
1 answer
45 views

How to make sure functions finish before next start? Flutter initState()

i am encountering error, which I believe is related to initState() function, I am using firebase and load data from it, and I need to ensure that initializeData(); is done before initializeSorting() ...
jon's user avatar
  • 33
0 votes
0 answers
19 views

Is it possible to reinitialize a git repo without deleting the local files?

I always get this error: pack-objects died of signal 9 error when I pull from my repo. I already tried all the commands I could find on Stackoverflow and the internet, none of them solved my issue, ...
th3_sh0w3r's user avatar
1 vote
1 answer
92 views

Dangerous class initialization method?

I use the following approach to automatically initialize a class that only has static methods (it's in a header-only library...) and should not be instantiated: class Config { public: Config() = ...
Jeroen Boschma's user avatar
0 votes
1 answer
21 views

How to know if init operation of empty data structure costs us O(1) or more? (on general)

I didn't find resources about how to choose the time complexity of init of empty data structure. I know it is based on implementation and programing languages, but I assume there are conventions. For ...
Daniel Mass's user avatar
0 votes
1 answer
35 views

Is it possible to set an init-only explicit-implemented property?

Let's say we have a class, which must have only one parameterless constructor. The class also define a init-only setter property. class MyClass { public int MyProp { get; init; } } Since C# 9, we ...
Mario Vernari's user avatar
-3 votes
3 answers
78 views

How to get rid of the segmentation error while using C

Segmentation error in stdio.h #include <stdio.h> int main() { char arr[4]={"abcd"}; char *p; p=arr; for(int i;i<4;i++) { printf("%s\n",p[i]); ...
Jay's user avatar
  • 1

1
2 3 4 5
234