Compilation error while return function pointers

Purnendu purnendu@gmail.com
Wed Dec 27 07:07:00 GMT 2006


I am getting the Compilation error below which in valid:
error: cannot convert `int (*)(float, float, int)' to `int
(test1::*)(float, float, int)' in return

Can i get rid of this by using cast operators? Please provide some
pointer regarding this.

I am adding the code snippet below as a reference.
================================================================
int test1::member_test1(float a, float b, int c)
{

        return (static_cast<int>(a) + static_cast<int>(b) + c);
}

/* Define a type which is a function pointer for function member_test1 */
typedef int(test1:: *t_member_fptr_test1)(float, float, int);


int func_test2(float a, float b, int c)
{

        return (static_cast<int>(a) + static_cast<int>(b) + c);
}


t_member_fptr_test1  func_return_ptr()
{
        return &func_test2;// Error here

}
===============================================================



-- 
with regards,
purnendu ghosh
-----------------------------------------------------------------------
If you can D.R.E.A.M it you can D.O it
-----------------------------------------------------------------------



More information about the Gcc-help mailing list