Questions tagged [indirection]

Any of various programming concepts related to the level of abstraction applied to a particular problem, algorithm or scenario. Examples may include substituting higher-level programming constructs where previously lower-level constructs were previously applied.

Indirection

Any of various programming concepts related to the level of abstraction applied to a particular problem, circumstance, algorithm or knowledge domain.

160 questions
0
votes
2 answers

How do I extract code into a static method in Eclipse, passing fields as parameters?

Given this simplified scenario: private String name; private String getString() { return "Hello, " + name + "!"; } I would like to capitalize the name with a private static capitalize(String) method. If I extract name into a method (CTRL-2 +…
Nicolas
  • 2,321
  • 4
  • 21
  • 32
0
votes
1 answer

Operate on variables in Bash directly in a loop

My googlefu is failing me. I have a bunch of variables I read it from a CSV where I want to strip whitespace. I could variable1="$(echo -e "${variable1}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')" variable2="$(echo -e "${variable2}" |…
jmp242
  • 133
  • 3
0
votes
1 answer

Search by value of object property in an indirection array

I have an array of Int32, every element contains index of reference to an object in another array: class MyObject { public Int32 Time; } MyObject[] _objects; Int32[] _indices; Now i need to find index of an object which Time is closest to some…
Yola
  • 18,496
  • 11
  • 65
  • 106
0
votes
3 answers

Fastest way to call a javascript function (or method) via a lookup table of function names?

I am simulating an 8-bit microprocessor with JavaScript. I have stored each opcode function name in an array, and call each of the 256 functions relative to the opcode read from my virtual memory, as follows: this.OP[opcode] =…
0
votes
2 answers

Do more levels of indirection have a performance impact in C

If I have a structure containing an array of structures.... and on config.data.item[3].userFunction(); is it better to access with itemType * item = &config.data.item; item[3].userFunction(); item[4].userFunction(); or is this just the same as…
0
votes
1 answer

C Programming in OPNET

I'm starting some work into manual programming of nodes in OPNET however I am having a few troubles. I'm getting some information from packets and storing them in variables and want to output this to the simulation console. When I add the line…
Reidacus
  • 103
  • 2
  • 13
0
votes
1 answer

How should I refer to any arbitrary class attributes starting with a fixed string and differing by their ending numbers?

I am writing a Python program which uses ConfigParser to read a configuration file intended to control various aspects of the program's configuration, execution and orientation to its environment and landscape. I am using Python 2.6.6 on RHEL…
Justin Haynes
  • 79
  • 1
  • 7
0
votes
1 answer

Member access through pointer to object

On the stack the compiler is free to do a lot of optimizations, because the context is static and known at compile time, but when dealing with access to dynamically allocated objects and generally accessing "by reference" the context is not known,…
user2341104
0
votes
2 answers

C4047 - Levels of Indirection - Struct initialization

I am actually working with some old software of my company and I try to figure out how to make stuff works properly. After some database editing, I got a software that gives me some *.C files to compile later to get a environment simultation…
0
votes
2 answers

dynamic memory allocation, heap, indirection, NULL

I was trying to guarantee that memory I allocated dynamically is pointing nowhere. I tried the following template [...something here...] T *mem = new T[size]; for ( int i=0; i
user3272529
  • 115
  • 9
0
votes
2 answers

Program crash when trying to retrieve an U32 from a struct

I have been asked to finish some code someone else started, and I am completely confused on how to copy a U32 value inside an struct. These are the relevant parts of the various structs; note that I am trimming a lot because those are some seriously…
0
votes
4 answers

Pointers: a query about pointers

I'm learning C and C#. I'm learning about pointers and don't know what it means to combine the indirection operator and the address operator. What does it mean to combine the two? Here is an example: int *p, *q; p = *&q;
somethingSomething
  • 830
  • 7
  • 20
  • 43
0
votes
2 answers

Dereferencing a double pointer just once?

Hi I have a question about double pointers. For example in this code: int a, b=2; int *iPtr1, **iPtr2; iPtr1 = &a; iPtr2 = &iPtr1; *iPtr1 = b+3; *iPtr2 = iPtr1; On the last line *iPtr2 = iPtr1; It that just telling iPtr1 to point back to…
MeesterMarcus
  • 700
  • 1
  • 9
  • 25
0
votes
2 answers

Design of a general-purpose handler class with swappable handler code?

I want to write a general-purpose handling class for files. This class is to load a specific handler instance depending on the type of file that's passed to it. One of the methods inside would work like this (see comments): public void doSomething(…
James P.
  • 19,313
  • 27
  • 97
  • 155
0
votes
1 answer

Overloaded 'dereference' or 'member of pointer' operators don't get run when I have a pointer to an object

I have the following code: #include struct Base { int i_; }; class El : protected Base { public: int get_i() const { return i_; } void set_i(int i) { i_ = i; } }; class It : protected Base { public: using pointer =…
user283145
1 2 3
10
11