Re: Experiences using "register"
- From: santosh <santosh.k83@xxxxxxxxx>
- Date: Sun, 30 Mar 2008 21:19:36 +0530
Ioannis Vranos wrote:
Harald van Dijk wrote:
On Sun, 30 Mar 2008 18:01:45 +0300, Ioannis Vranos wrote:
Harald van Dijk wrote:
On Sun, 30 Mar 2008 16:55:58 +0200, Richard wrote:Still, you don't know how many times it will be called in the
Ioannis Vranos <ivranos@xxxxxxxxxxxxxxxxxxxxxxxxx> writes:If the function is huge, but it's only called from one place,
Willem wrote:Because it adversely affects code size is one thing I can think of
You're arguing in circles again.Why "inline" should be used with small functions only?
Why should 'register' be used only when it has minimal effect on
the code ?
...
inlining may even decrease the code size.
future, so it is a bad practice.
Yes, I do, if it's something like the main loop of an event-driven
program, or library initialisation. It doesn't make any sense to call
that more than once, or from different locations.
This reminds me something I have read elsewhere. Something like "no
rule is so general that it has no exceptions".
In any case, how much size will you save if you make this one-called
function inlined? The same minus a function call (an address) in the
automatic storage.
The main purpose of inline is to take away the function call and return
overhead, and this can make sense only for a function that is very
small and finishes very quickly, and is called often, or if the
performance of that function is critical. Otherwise the code for the
function is going to swamp any benefit from shaving of the call/return
instructions. Using inline for affecting code size is, IMO, misusing
it. Again the standard inline keyword is like register: just a hint. A
macro is going to give you an assurance of inlining at the cost of loss
of parameter type checking, or you might try compiler specific options
to force inlining of certain functions.
.
- Follow-Ups:
- Re: Experiences using "register"
- From: Willem
- Re: Experiences using "register"
- References:
- Experiences using "register"
- From: Spiros Bousbouras
- Re: Experiences using "register"
- From: Willem
- Re: Experiences using "register"
- From: Willem
- Re: Experiences using "register"
- From: Willem
- Re: Experiences using "register"
- From: Richard
- Re: Experiences using "register"
- From: Willem
- Re: Experiences using "register"
- From: Richard
- Re: Experiences using "register"
- From: Willem
- Re: Experiences using "register"
- From: Harald van Dijk
- Re: Experiences using "register"
- From: Ioannis Vranos
- Experiences using "register"
- Prev by Date: Re: Reentrant functions and memory allocation
- Next by Date: Re: Experiences using "register"
- Previous by thread: Re: Experiences using "register"
- Next by thread: Re: Experiences using "register"
- Index(es):
Relevant Pages
|