Path: utzoo!attcan!uunet!lll-winken!lll-tis!helios.ee.lbl.gov!pasteur!ames!nrl-cmf!cmcl2!rutgers!bellcore!faline!thumper!ulysses!andante!alice!shopiro From: shopiro@alice.UUCP (Jonathan Shopiro) Newsgroups: comp.lang.c++ Subject: Pointers to functions (was Re: Pointers to Inline Members) Summary: use typedefs for function pointers Message-ID: <8147@alice.UUCP> Date: 30 Aug 88 14:13:34 GMT References: <3690002@wdl1.UUCP> <8808271631.AA21050@explorer.dgp.toronto.edu> Organization: AT&T Bell Laboratories, Murray Hill NJ Lines: 23 In article <8808271631.AA21050@explorer.dgp.toronto.edu>, flaps@dgp.toronto.edu (Alan J Rosenthal) writes: > > ... > While testing this, I found the compiler unwilling to take a local > declaration of the form: > int (*f)(int); This question seems to come up pretty often. The problem is a due to a limitation of the compiler. The solution is to use a typedef, e.g., typedef int FINT(int); FINT* fp; or typedef int (*FINTP)(int); FINTP fp1; In the above, fp and fp1 have the same type. I prefer the first method because it seems simpler and I like to see stars where there are pointers. -- Jonathan Shopiro AT&T Bell Laboratories, Murray Hill, NJ 07974 research!shopiro (201) 582-4179