a pointer to a function, which can be stored in a variable allows a run-time choice of which function to run

learn more… | top users | synonyms (1)

0
votes
0answers
13 views

Changing function pointers after compilation

I am using Ogre3 to try to build a Spawner that automatically creates copies of an Enemy and drop them into the world. In addition to this, I want to save a behavior function so that when the entity ...
-3
votes
1answer
57 views

c++: Address will always evaluate to true error [closed]

I wrote my own atexit method, the problem is, everything passed in is 1. When I attempted to print the address before providing it to my atexit, the compiler generated the following warning: void ...
0
votes
0answers
12 views

what is a preferred mode to communicate with the driver, ioctl vs escape callback

I'm on a windows environment here. I wanted to understand the differences (be it performance, pros/cons) between using ioctl call vs escape calls. ioctl call Escape call looks something like this ...
0
votes
2answers
41 views

Deleting allocated array within function vs in main

If I declare a allocated pointer inside main char *ch2=new char[10*17]; char *ch2p=ch2; while(infile.get(*ch2)) { cout<<*ch2; ch2++; } ................................. char ...
3
votes
1answer
34 views

Getting documentation from a function handle

Generically, if I have a function handle (but not the function name), is there a way to see the "help" comment block associated with that function?
2
votes
4answers
81 views

How to pass a pointer to a struct into a function using C Language?

i'm new to developing with c. sure enough there'd come a day i need your help. And I guess this time is now :) What I am trying to do: I am experimenting with MySQL Api in C. For that i wanted to use ...
2
votes
2answers
101 views

ScopedExit implementation: pass arguments to the function object

I'm trying to implement simple ScopedExit class. Here's the code: #include <iostream> #include <functional> template<class R, class... Args> class ScopedExit { public: ...
13
votes
3answers
308 views

Do function pointers need an ampersand

In C/C++, if I have a the following functions: void foo(); void bar(void (*funcPtr)()); Is there a difference between these two calls: bar(foo); bar(&foo); ?
2
votes
6answers
132 views

C++ member function pointer with different arguments - or is this bad anyway?

Even though I fear that you will tell me that this topic was covered several time, I dare to ask it, since I was not able to generate a solution. Probably I was just looking for the wrong thing... ...
0
votes
1answer
17 views

Allocated arrays in functions

Lets say you have this in main int* test; test = createArray(test); and this is function int * creatArray(int* temp) { temp = new int [35]; return temp } Why do you need to return the ...
1
vote
3answers
87 views

Functional programming in C/C++?

I have been reading this article: http://en.wikipedia.org/wiki/Function_pointer and am sort of confused. Since C/C++ support function pointers, doesn't that mean they support functional programming in ...
1
vote
1answer
26 views

Calling back into a native application from Java, via JNI

So I built this C library. It calls Java methods via the JNI, everything works fine. But how can I call back from Java into my C application? I imagine the following: I do have a function, I take its ...
1
vote
2answers
61 views

How do I use function pointers?

I have a problem with a function on a binary tree.The Tree houses client structs which among other thing, have an id number and a date field. I need to make 3 functions, 2 find_client functions , one ...
0
votes
3answers
90 views

Does “this” also adapt to function pointers?

Java has a construct that allows a method to call itself via a "this()" reference. The name of this convention escapes me at the moment. EDIT: Known as Constructor Delegation as pointed out below. ...
0
votes
1answer
33 views

Similar Objective-C KVO in c++

I have this architetture: I have a thread that continuously monitors the status of a shared variable. I would like to develop a system similar to Objective-C KVO in c++ . In practice, I would like to ...

1 2 3 4 5 87
15 30 50 per page