avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] Improving in leaps and skips!


From: Richard Urwin
Subject: Re: [avr-gcc-list] Improving in leaps and skips!
Date: Wed, 2 Mar 2005 22:24:18 +0000
User-agent: KMail/1.5.3

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);
 ...
}

-- 
Richard Urwin




reply via email to

[Prev in Thread] Current Thread [Next in Thread]