Path: utzoo!utgpu!watserv1!watmath!att!rutgers!cmcl2!acf5!sabbagh From: sabbagh@acf5.NYU.EDU (sabbagh) Newsgroups: comp.sys.mac.programmer Subject: Re: Bug in MPW C 3.1 compiler Message-ID: <1272@acf5.NYU.EDU> Date: 19 Oct 90 19:57:55 GMT References: <1990Oct19.081120.1@csc.fi> Reply-To: sabbagh@acf5.UUCP () Organization: New York University Lines: 40 In article <1990Oct19.081120.1@csc.fi> hnevanlinna@csc.fi writes: > /* Crashes MPW at compile time! Bug found by P.Janhunen 90-09-19 */ > >#include > >void SomeProcedure(int func(int x)) >{ > printf("Within SomeProcedure: func(10) returned %d\n",func(10)); >} > >int Square(int arg) >{ > return arg*arg; >} > >main() >{ > SomeProcedure(Square); >} > I don't understand what you mean "crash at compile time"; this should return a syntax error complaint at the declaration of SomeProcedure. Here's how SomeProcedure should be written: void SomeProcedure(int (*func)(int)) { printf("Within SomeProcedure: func(10) returned %d\n", (*func)(10)); } Hadil G. Sabbagh E-mail: sabbagh@cs.nyu.edu Voice: (212) 998-3125 Snail: Courant Institute of Math. Sci. 251 Mercer St. New York,NY 10012 "No talking to invisible people." - Sign in Top Dog, Durant Ave., Berkeley Disclaimer: This is not a disclaimer.