[comp.lang.c++] Function pointers

starr-page@CS.Yale.EDU (Page Starr) (10/26/89)

Why does the following code fragment compile (under CC and G++(1.36.0-))

typedef int (*pfi)();
main()
{
 pfi c;
}

as well as

int (*pfi)();
main()
{
}

But the following does not (syntax error)

main()
{
int (*pfi)();
}

and neither does the following...

main()
{
int (::*pfi)();
}

typedef seems to get around the problem (can typedef in main() OK as well),
but shouldn't be necessary...

-----------------------------------------------------------------------------
What will you say to the Revolutionary Committee, when it assumes power?
-----------------------------------------------------------------------------
CSnet:   starr@cs.yale.edu			BITNET:  starr@yalecs.BITNET
ARPAnet: starr%cs.yale.edu@relay.cs.net		Phone:	 (203)432-1215
USmail:  Page Starr, Box 2158 Yale Station, New Haven, CT  06520

shap@delrey.sgi.com (Jonathan Shapiro) (10/28/89)

main()
{
   int (*pfi)();
}

Compiles fine under C++ v2.0.  Thought you'ld like to know.

Jonathan Shapiro
Synergistic Computing Associates