a pointer to a function, which can be stored in a variable allows a run-time choice of which function to run
-1
votes
0answers
19 views
C Function Pointer: passing argument x of 'y' from incompatible pointer type
I have a warning in my code which I would like to get rid off. I defined the following:
#ifdef __OS_LINUX__
typedef void* (*UAS_TASK_CALLBACK_T)(void* arg);
typedef pthread_t UAS_TASK_DESC_T;
...
-1
votes
0answers
22 views
Assign function pointer - assignment from incompatible pointer type
I am trying to assign a function pointer to a variable, but I get the warning "assignment from incompatible pointer type"
This is how I define my structure
#ifdef __OS_LINUX__
typedef void* ...
1
vote
1answer
30 views
how to pass pointer to member function of a template class?
I just faced an interesting challenge, let's solve it together:
I had a Broker class similar to this:
//Broker.h
#pragma once
#include <boost/shared_ptr.hpp>
template<class ...
1
vote
4answers
45 views
is “function Pointer” in c++ similar in behavior with “delegate” in c#?
I have a small question.
is function Pointer in C++ similar in behavior with delegate in C# ?
0
votes
1answer
5 views
Apply matrix operation to every k-dim row in an n-dim matrix
Does octave have a method by which you can take a function which applies to every column in a 2-dimensional matrix and convert it into a function which applies to every line along the kth dimension in ...
0
votes
2answers
23 views
Getting a function pointer to a dynamic library in C (C89)
I have a function pointer to a dynamic library,
#include <GL/gl.h> /* or something */
void (*vertex)(float, float) = &glVertex2f;
On GCCi686-apple-darwin10-gcc-4.2.1 it's always worked, ...
-1
votes
0answers
9 views
How to use template function and pointer correctly?
I am reading someone's program and for better understanding of the idea I rewrite it into a small code. But when I try to compile I get some error. Thanks for the help.
#include <stdio.h>
...
0
votes
1answer
40 views
C, pointer to function in struct, warning “assignment from incompatible pointer type”
I have a struct defined as follow:
typedef struct {
char (*behave) (int*);
} BEHAVIOURSTRUCT;
this struct is defined in a .h file and it is included in the .c file
There i have a global ...
1
vote
2answers
71 views
Global function pointer. multiple definition error
I have some functions in delphi dll, and I want to load them (using QtLibrary) at once.
Can I store that functions in global variables to use it? I tried to declare global function pointer in .h file ...
8
votes
4answers
182 views
When is an array name or a function name 'converted' into a pointer ? (in C)
1) Misconception :
Whenever an array is declared in C language, a pointer to the first element of the array is created (the name of the array) implicitly. (Is it? I don't think so!)
The first two ...
0
votes
3answers
99 views
templated double-dispatching using function pointers
I’m trying to make a custom collision engine for academic purposes and I got stuck on a general c++ programming issue. I already have all the geometries which work properly and the collision test also ...
-4
votes
0answers
34 views
Pointers using poker game in C
I have to modify the poker.c program by moving all external variables into main and modifying functions so that they communicate by passing arguments. The analyze_hand function needs to change the ...
0
votes
2answers
60 views
c++ - Function pointer object seems not to to exist
I'm writing some kind of libary which organizes and keeps track of some tasks. Whenever a nwe task is called my libary uses a function pointer given in the constructor. But when I try to call it I get ...
2
votes
2answers
31 views
Parameter of type Func2 in QObject::connect?
QObject::connect takes parameters as following:
connect(const QtPrivate::FunctionPointer<Func1>::Object *sender, Func1 signal,
const QtPrivate::FunctionPointer<Func2>::Object ...
0
votes
2answers
119 views
C++ function types
I have a problem understanding function types (they appear e.g. as the Signature template parameter of a std::function):
typedef int Signature(int); // the signature in question
typedef ...