Quoting the current C ++ standard (C ++ 11):
[dcl.fct] / 10
A typical function type can be used to declare a function, but should not be used to define a function (8.4). [Example:
typedef void F(); F fv;
-end example]
That is, you can declare, but not define a function using typedef . You must explicitly state the signature, see Alex Farber Response.
To some extent, you can use typedef to βdefineβ a function, but it includes template magic. This is just a fun example showing that you can use it to define a function.
// extra definitions for SSCCE typedef unsigned int DWORD; typedef wchar_t* LPWSTR;
source share