Re: what is static inline void tvec_base

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

 



On Fri, Aug 27, 2010 at 11:41 PM, James Bond <jamesbond.2k.g@xxxxxxxxx> wrote:
> Hi,
> Stephan thanks a lot for the link.
> I also have a small doubt.Please see if you can resolve
>
> As per my understanding
>
> 1) Defining any function as static tells the compiler that the
> function can only be used in the file the function was defined in

That's my understanding too!

> 2) inline function is that, even though you can have
> multiple definitions of them across source files, there's only ever one
> instance of their static variables

The use of inline is a performance issue, not a functional reason.

ie. very small functions execute faster if they they are "inlined"
into their caller.  That means the actual machine code that implements
the function is placed directly inline with the normal flow of machine
code at the location of the supposed call.

ie. With a normal function, there is only one instance of the
implementing machine code and each time it is called, the cpu has to
use that one instance to do the work.  For inline functions, a new
instance of the code is created for every call and the new instance is
placed inline with the normal control flow of the machine code.

The other big issue with inline is along the lines of what Mulyadi
said.  It's a only a way to give guidance to the compiler.  And as the
gcc has gotten better and better, the keyword inline is less and less
useful.  The compiler now looks for situations where it makes sense on
its own.  And it also will ignore the inline keyword if it thinks its
a bad choice.

With gcc from the last couple years, i think the basic guidance is to
not waste your mind power on using the inline keyword.  It all happens
automatically behind the scenes.

fyi:  the gcc docs are also a great place to read about specific
keywords and how gcc handles them.

http://gcc.gnu.org/onlinedocs/gcc-4.1.1/gcc/Inline.html

note the last sentence of that doc

               GCC does not inline any functions when not optimizing
unless you specify the `always_inline' attribute for the function,
like this:

Thus the inline keyword is always ignored by gcc if your not compiling
with optimization enabled.

HTH   (Hope That Helps)
Greg
> Am I correct?
> On Sat, Aug 28, 2010 at 9:08 AM, StephanT <stman937-linewbie@xxxxxxxxx>
> wrote:
>>
>> > Please give some online link to what you said I will go through it.
>>
>>
>> http://www.google.com/search?hl=en&client=firefox-a&hs=yTX&rls=org.mozilla%3Aen-US%3Aofficial&channel=s&q=dennis+ritchie+c+pdf&cts=1282966271211&aq=2sx&aqi=g-s1g-sx9&aql=&oq=denis+ritc&gs_rfai=
>>
>>
>>
>> Say a short prayer every time you open this book !
>>
>> Good luck,
>> Stephan
>>
>
>
>
> --
> To be yourself in a world that is constantly trying to make you something
> else is the greatest accomplishment
>
>



-- 
Greg Freemyer
Head of EDD Tape Extraction and Processing team
Litigation Triage Solutions Specialist
http://www.linkedin.com/in/gregfreemyer
CNN/TruTV Aired Forensic Imaging Demo -
   http://insession.blogs.cnn.com/2010/03/23/how-computer-evidence-gets-retrieved/

The Norcross Group
The Intersection of Evidence & Technology
http://www.norcrossgroup.com

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ




[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux