The automatic solution is cdecl.
In general, you declare a variable the way you use it. For example, you are looking for a pointer p like:
char c = * p
you state it in the same way:
char * p;
The same goes for hairy function pointers. Let f declare a good old "function pointer returning a pointer to int" and the external declaration is just ridiculous. This is a function pointer, so we start with:
extern * f ();
It returns a pointer to int, so somewhere there
extern int * * f (); // XXX not quite yet
Now, what is the correct associativity? I never remember, so use parentheses.
extern (int *) (* f) ();
Declare it the way you use it.
jfm3 Sep 20 '08 at 3:48 2008-09-20 03:48
source share