Path: utzoo!attcan!uunet!seismo!sundc!pitstop!sun!decwrl!decvax!ima!cfisun!lakart!dg From: dg@lakart.UUCP (David Goodenough) Newsgroups: comp.lang.c Subject: Re: arrays... Message-ID: <96@lakart.UUCP> Date: 9 May 88 14:06:28 GMT References: <282@teletron.UUCP> Organization: Lake - The systems people Lines: 36 From article <282@teletron.UUCP>, by andrew@teletron.UUCP (Andrew Scott): > I was struck by Chris' comment, however. How would unnamed functions be > implemented? How would they be used? The { .. } syntax for aggregate declar- > ations seems natural enough to use for unnamed aggregates, but how would it > be done for functions? Something like this: int (*foo)(); /* foo is a pointer to a func returning int */ foo = (a, b) int a, b; { return (a < b ? a : b); }; would make foo point to an unnamed function that returns the minimum of it's two arguments. The most obvious use for such a "feature" (?) would be in the invocation of routine like qsort, which takes a function as an argument: qsort(array, nelem, sizeof(char *), (a, b) char **a, **b { return (strcmp(*a, *b)); } ); Kind of ikky, but you get the idea. P.S. don't suggest this to the ANSI crowd: we don't need another re-run of the noalias -- dg@lakart.UUCP - David Goodenough +---+ | +-+-+ ....... !harvard!adelie!cfisun!lakart!dg +-+-+ | +---+