Re: Inline Functions ...

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

 





On Thu, Sep 18, 2008 at 5:56 PM, Manish Katiyar <mkatiyar@xxxxxxxxx> wrote:
On Thu, Sep 18, 2008 at 5:22 PM, Sandeep K Sinha
<sandeepksinha@xxxxxxxxx> wrote:
> Hi Mahaveer,
>
> On Thu, Sep 18, 2008 at 3:59 PM, mahaveer darade <mah.darade@xxxxxxxxx>
> wrote:
>>
>>
>> On Thu, Sep 18, 2008 at 5:41 AM, Balraj Dahiya <dahbal76@xxxxxxxxx> wrote:
>>>
>>> Hi All,
>>>
>>> Why we use Inline Functions in Linux Kernel? What is the importance of
>>> Inline functions and where we should use them?

About static function, it may be the case that function declared as inline in one file may not be inline in other file. To overcome this, Linux kernel uses static inline function.


 

>>
>> its just a suggestion( not mandatory )  to compiler to substitute code of
>> function into caller.
>> there are plenty of scenarios to think of its usage.
>
> What do you mean by its "not mandatory" ? Well, the compiler has to follow
> the standards, if specified. And "inline" keyword is stated quite clearly
> everywhere. And it has a very trivial meaning.
>
> Can you tell me any scenario, where you would mark a function to be inline
> and not expect to be patched into the caller.

Just write a function of 200 lines and then put it with inline. And
then check in gdb if it is actually inlined.....


>>
>>
>>>
>>>
>>> Is it mandotary to put "static" before inline which declaring the inline
>>> function?
>>
>> no its not mandatory. but if you do then you have to take care of couple
>> of thinks like if u take pointer to static inline functions then they won't
>> match & code is going to behave differently.
>
> Do you intend to say that pointers to static inline functions won't match ?
> And the behavior is unpredictable ?
>
>>
>>
>>>
>>>
>>> Can you please explain it to me?
>>>
>>> Thanks,
>>> Raj
>>
>>
>>
>> --
>> ---------------------------
>> Thanks & Regards,
>> Mahaveer Darade
>> mah.darade@xxxxxxxxx
>> Mobile - 9970365267
>>
>>
>> --- Dream it , Code it.
>>
>
>
>
> --
> Regards,
> Sandeep.
>
>
>
>
>
>
> "To learn is to change. Education is a process that changes the learner."
>

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




--
Shyam
Software Engineer
Brocade (http://www.brocade.com)
"Born To Learn"

[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