Initialization deals with the (often dreaded) task of initializing the contents of your data structure. It's a common practice in statically-typed languages.
3
votes
2answers
51 views
java method call on multiple objects
I installed a plugin for eclipse that helps creating a JFrame in a UI.
The code generated form the plugin has some strange syntax.
I never ever saw something like this in java:
private JPanel ...
5
votes
3answers
79 views
local variables are not static but
When I teach C, sometimes I count on GCC to do the "convincing" part of some rules. For example, one should not consider that a local variable on a function retains the value between calls.
GCC ...
12
votes
2answers
623 views
Forward References - why does this code compile?
Consider this snippet:
object A {
val b = c
val c = "foo"
}
println( A.b ) // prints "null"
As part of a larger program, this would lead to a failure at runtime. The compiler ...
2
votes
3answers
138 views
Is it possible to use a lambda function inside of a vector's constructor?
Is there a way to initialize all values of some container using a lambda function like one would do using std::for_each? I need a 3-dimensional std::vector of random ints, and it would be nice if I ...
0
votes
3answers
61 views
Is initializing a variable with an uninitialized variable legal?
The following C++ code is legal:
char* ptr;
while the following is not (using an uninitialized variable is UB):
ptr++;
Will the following code:
char* ptr2 = ptr;
be legal or will it be ...
2
votes
1answer
28 views
C++ and OpenMP: How to make the initializer list of a constructor critical?
In C++ with OpenMP, is it possible to make the operations performed in the initializer list of a constructor critical in the sense of #pragma omp critical?
1
vote
1answer
87 views
Delphi7 How to make Com object wait until program initilisation is complete?
I have a Delphi7 program which implements a com server. Recently the time for program initialisation to complete has increased somewhat due to some new database queries. What I mean by program ...
0
votes
6answers
244 views
How to create instance of a class from class name without using reflection?
Is there any way to achieve something like this?
If "Employee" is passed as an argument to a method it should return an object of type Employee.
But without using reflection.
0
votes
2answers
23 views
error: invalid initialization of non-const reference of type…from a temporary of type [duplicate]
I thought I could create and populate a C++ map like this:
39 int main(){
40
41 cout << "Approximate travelling salesman path finder." << endl;
42 cout << ...
2
votes
1answer
20 views
How can I initialize an array of previously defined arrays at compilation time?
I am using GCC 4.7.2 (C99) and Atmel Studio 6 for a microcontroller project.
I want to define a series of 1-dimensional arrays, then arrange these into various 2-dimensional arrays for predefined ...
2
votes
6answers
104 views
How to initialize KeyValuePair object the proper way?
I've seen in (amongst others) this question that people wonder how to initialize an instance of KeyValuePair, which expectedly should look like this.
KeyValuePair<int, int> keyValuePair = new ...
-1
votes
1answer
145 views
Fully instantiating an object through reflection without constructor
The closest answers I found related to this question didn't really do anything to help solve it, though perhaps I did a poor job searching for it.
Get a new object instance from a Type
Reflection ...
3
votes
2answers
306 views
Create instance with type object during runtime [duplicate]
I have the following code
//^process a aquery and return DataTable
DataTable d t= dbConnect.ProcessQuery(strquery);
Type t = dt.Columns[0].DataType.GetType();
How to create objects of type t that ...
0
votes
0answers
9 views
c# Initialize Appsettings from database
We have an already existing console application which currently uses File based AppSettings.
So my app.config points to my actual appsettings file :
<appSettings ...
0
votes
0answers
44 views
How could it be that static field is not initialized before it is accessed?
I have following code:
public class BufferedChart
{
...
private static LineClass m_lineDrawingAlgorithm = new LineClass();
...
public BitmapData LockBitmap()
{
...
unsafe
{
...