[En-Nut-Discussion] FRC: Direct or Pointer
harald.kipp at egnite.de
Sun Nov 13 10:54:35 CET 2011
On 03.11.2011 21:21, Thiago A. Corrêa wrote:
> Doesn't inline in C require c99?
Good point. Indeed both variants, inline functions and macros must be
> Also, using structs has allowed Ulrich to make the code a lot smaller
> if I recall an older email. So this is a nice plus to that.
Yes, this might happen. Using structures enables the compiler to keep
the structure's base address in one register and access specific items
with an offset that fits in the instruction word. On the other hand,
using an additional register may lead to less optimal code.
That's difficult to predict without evaluating a few real world test
cases. I remember having read about an interesting result: After
switching some Linux drivers from volatile register definitions to
memory barriers, the compiler unexpectedly created smaller code.
More information about the En-Nut-Discussion