On Tuesday 01 Mar 2005 7:45 pm, E. Weddington wrote:
Björn Haase wrote:
int
foo3 ( int func(int), int a)
{ return a + a * func (27);
}
void
foo (int a, int b)
{
int
foo2 (int c)
{ return c + b;
}
return foo3 (&foo2, a);
}
is considered to be legal code for gcc. The avr port does presently
lack support for this extension.
Bleah. :-P
I wouldn't even know why that would even be used.
Say you're calling a sort routine that uses a function parameter to do
the comparison. Instead of muddying file scope with a function that
does the comparison, you can put it inside the function that calls the
sort routine.
void foo ()
{
int a[...], b[...];
bool compint(int a, int b) {return a > b;}
...
sort (a, b, sizeof(a[0]), compint);
...
}