This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Compilation error while return function pointers
- From: Purnendu <purnendu at gmail dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Wed, 27 Dec 2006 12:37:11 +0530
- Subject: Compilation error while return function pointers
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
-----------------------------------------------------------------------