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: E. Weddington
Subject: Re: [avr-gcc-list] Improving in leaps and skips!
Date: Wed, 02 Mar 2005 15:47:52 -0700
User-agent: Mozilla Thunderbird 0.7.3 (Windows/20040803)

Richard Urwin wrote:

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


Ok, but this could easily be done with the comparison routine defined outside of the function and declared static to the file. But I see your point. I just don't necessarily agree that it's overall more advantageous.

Eric





reply via email to

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