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

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

[avr-gcc-list] Re: Array of pointers to functions


From: Lars Jeppesen (address@hidden)
Subject: [avr-gcc-list] Re: Array of pointers to functions
Date: Tue, 20 Jul 2004 15:09:47 +0200

>>> "Royce & Sharal Pereira" <address@hidden> 07/19/04 11:24am >>>
>>-----------------------------------
>>Actually this was just an example, I have arrays of upto 16 function pointers!
>>And a 'switch' with 16 calls is not only ugly in comparison, it is also slow 
>>, besides more work to
>>write ;)


Hi,

I'm actually having the same problem.

I investigated it a bit and found out the a switch statement actually was the 
"correct" way to do it.
The compiler should then just generate a jump table.
(One of the reasons for this to be the correct way, is that your code then 
should be more portable between compilers/targets)

The problem is that the gcc-avr compiler is not really happy about changing the 
switch to a jump table.
I made some tests and found out that I needed to put 25+ cases in the switch 
statement before it was changed to a jump table.

I couldn't find any parameters to adjust this threshold for jumptables in the 
gcc-avr compiler.

I whould be really nice if there was some way to force the compiler to generate 
a jump table.

Best regards
  Lars


Lars Jeppesen
Development Engineer B.Sc.
JVL Industri Elektronik A/S
Blokken 42, DK-3460 Birkerød, Denmark
Tlf: +45 4582 4440. Fax: +45 4582 5550
Email: address@hidden, Web: www.jvl.dk 



reply via email to

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