hnevanlinna@csc.fi (10/19/90)
A friend of mine has found a bug in MPW C 3.1. ( MPW 3.1 also ). /* Crashes MPW at compile time! Bug found by P.Janhunen 90-09-19 */ #include <stdio.h> 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); } This bug occurs with or without extra inits, so it seems to be a real problem. Jouni Ryn
sabbagh@acf5.NYU.EDU (sabbagh) (10/20/90)
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 <stdio.h> > >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.