[sdiy] help...no make8() function in Arduino...converting PIC to AVR

Ingo Debus igg.debus at t-online.de
Wed Apr 11 21:44:00 CEST 2012


Am 11.04.2012 um 19:17 schrieb Ove Ridé:

> I would avoid using functions, as they incur a small overhead in
> making the function call, as opposed to a simple mathematical
> expression.

This depends on how smart the compiler is. Recently I was very surprised because I had added another function call to my C program which made actually made the code a few bytes *smaller* (which I was very grateful for, because I was really tight on program memory). The explanation was, with that additional function call there was a sequence of function calls that appeared in exactly the same sequence somewhere else in the program. The compiler recognized that and obviously packed that sequence into a subroutine. This was the Keil 8051 compiler.

OTOH the compiled would probably not create a subroutine from a C function if it is called only once.

As someone else said here, it's probably not a good idea trying to help the compiler to make good code...

Ingo


More information about the Synth-diy mailing list