Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

function pointer without typedef

Is it posible to use the type of a prefiously declared function as a function pointer without using a typedef?

function declaration:

int myfunc(float);

use the function declaration by some syntax as function pointer

myfunc* ptrWithSameTypeAsMyFunc = 0;
like image 816
David Feurle Avatar asked Sep 22 '10 14:09

David Feurle


Video Answer


1 Answers

Not as per the 2003 standard. Yes, with the upcoming C++0x standard and MSVC 2010 and g++ 4.5:

decltype(myfunc)* ptrWithSameTypeAsMyFunc = 0;
like image 66
Anthony Williams Avatar answered Oct 03 '22 10:10

Anthony Williams