Board index » Visual Studio » Array of function pointer that points to return ...

Array of function pointer that points to return ...

Visual Studio170
Suppose I have :



void f1()

{

TRACE("f1\n");

};



void f2()

{

TRACE("f2\n");

};



void Dummy()

{

return;

}



void (*f[3]) ();



f[0] = f1;

f[1] = f2;

f[2] = Dummy;



I want the f[2] call to be a return (call do nothing). Is there a way to

make this without defining a Dummy function that just return. Something like

f[2] = void (*) () return;


-
 

Re:Array of function pointer that points to return ...

H.B. wrote:

Quote
Suppose I have :



void f1()

{

TRACE("f1\n");

};



void f2()

{

TRACE("f2\n");

};



void Dummy()

{

return;

}



void (*f[3]) ();



f[0] = f1;

f[1] = f2;

f[2] = Dummy;



I want the f[2] call to be a return (call do nothing). Is there a way

to make this without defining a Dummy function that just return.

Something like f[2] = void (*) () return;



No.





-

Re:Array of function pointer that points to return ...

H.B. wrote:

Quote
Suppose I have :



void f1()

{

TRACE("f1\n");

};



void f2()

{

TRACE("f2\n");

};



void Dummy()

{

return;

}



void (*f[3]) ();



f[0] = f1;

f[1] = f2;

f[2] = Dummy;



I want the f[2] call to be a return (call do nothing). Is there a way

to make this without defining a Dummy function that just return.

Something like f[2] = void (*) () return;



Perhaps lambda-programming can help you. See

www.boost.org/libs/lambda/doc/index.html">www.boost.org/libs/lambda/doc/index.html for example.



Arnaud





-