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.

Initialization deals with the task of initializing the contents of data structures. This is the initialization of an object, structure, blob of data, or any entity which contains state that must be prepared prior to usage of the entity.

11649 questions
6
votes
1 answer

Double Brace initialization Type Confusion

I thought this was going to be relatively easy, but alas, it seems it isn't. I am currently writing Unit-Tests for a Facade-like structure in my Project using Java EE 6. For the Tests I use Junit 4.11, with Eclipse Kepler as IDE. From what I can…
Vogel612
  • 5,620
  • 5
  • 48
  • 73
6
votes
2 answers

nhibernate configure and buildsessionfactory time

I'm using Nhibernate as the OR/M tool for an asp.net application and the startup performance is really frustrating. Part of the problem is definitely me in my lack of understanding but I've tried a fair bit (understanding is definitely improving)…
davidsleeps
  • 9,393
  • 11
  • 59
  • 73
6
votes
2 answers

Hooking into AppInitialize with WCF service

I'm having issues with my WCF service. I need to do a windsor container injection pre application_start and noticed I can use the AppInitialise method. It works on visual studio debug but when I deploy to IIS the code does not get fired.. I…
Mark
  • 61
  • 1
  • 2
6
votes
2 answers

Designated initializers and compound literals for struct in C

I have following struct: typedef struct my_struct { int a; int b; int *c; } my_struct; is: my_struct n = (my_struct) { .b = 3 }; equivalent to: my_struct n = (my_struct) { .a = 0, .b = 3, .c = NULL }; What about: my_struct n =…
zodiac
  • 353
  • 3
  • 18
6
votes
2 answers

Is Java class initialized by the thread which use it for the first time?

Lets assume following classes definition: public class A { public final static String SOME_VALUE; static { SOME_VALUE = "some.value"; } } public class B { private final String value = A.SOME_VALUE; } Assuming that the…
oo_olo_oo
  • 2,815
  • 5
  • 28
  • 25
6
votes
1 answer

struct initialization / assignment with braces

I have defined a struct as follows: struct float3 { float x; float y; float z; float3 () : x(0), y(0), z(0) {} float3 (float a, float b, float c) : x(a), y(b), z(c) {} }; But i have trouble when it comes to understanding the different ways of…
Noel
  • 730
  • 6
  • 15
6
votes
2 answers

C++ static const and initialization (is there a fiasco)

I am returning to C++ after a long absence and I am stumbling a little over my understanding of the fairly well known static initialization problem. Let's say I have a simple class Vector2 as given below (note that I am aware that x and y should be…
Matt__E_
  • 277
  • 2
  • 9
6
votes
1 answer

Correct way to initialize boost::shared_ptr

I am just getting started to work with boost::shared_ptr so I have searched around and I see that there are several ways of initializing it: boost::shared_ptr myclass = boost::shared_ptr(new MyClass()); boost::shared_ptr
UserIq
  • 93
  • 2
  • 6
6
votes
3 answers

How JVM loads parent classes in Java

Code: class A { static { System.out.println("loading A static 1"); } static { System.out.println("loading A static 2 B.c= "+B.c); } static { System.out.println("loading static 3"); } static…
Kalhan.Toress
  • 21,683
  • 8
  • 68
  • 92
6
votes
2 answers

'non-static reference member, can't use default assignment operator'

I get this error when i try to compile my code: non-static reference member ‘Timestep& Timestep::previousTimestep’, can’t use default assignment operator I create one Problem which creates a Timestep a reference to the this Timestepshould be stored…
dani
  • 3,677
  • 4
  • 26
  • 60
6
votes
3 answers

Java array object initialization

I just want ask, is it possible to initiliaze more objects with same constructor in one command? Example of code: Tile[] tiles = new Tile(5,5)[20]; Thanks for response.
user2899587
  • 189
  • 2
  • 3
  • 11
6
votes
4 answers

Class data default initialization

I have following code: #include using namespace std; class Base { private: int i; char ch; public: void showdata() { cout<<"Int:"<
mukeshkumar
  • 2,698
  • 3
  • 19
  • 20
6
votes
1 answer

Lazy initialization in iOS

Data comes from the server in JSON, which is placed in a NSDictionary. Depending on type of requested data the new class object will be created from this NSDictionary. There're a lot of data comes, so the object holds a reference to NSDictionary and…
Lion
  • 1,264
  • 1
  • 17
  • 23
6
votes
1 answer

Why Can const lvalue References Refer to Mutable rvalue References?

In C++11 a const lvalue reference can be initialized with a mutable rvalue reference. The value referred to by the rvalue can then change producing a visible mutation to what the const lvalue is referring to. Here is an example: int && rval =…
user2141130
  • 954
  • 7
  • 22
6
votes
5 answers

why is it a bad practise to not initialize primitive fields in a class?

Java primitives always have a default value in the memory of O (booleans are false = 0). So why is it considered as a bad practise to not initialize them, if they even have a predefined value because of this mechanic? And in arrays, even with…
Pwnie2012
  • 143
  • 1
  • 7