can I safely ignore inline ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • toton

    #1

    can I safely ignore inline ?

    Hi,
    Can I safely ignore the inline keyword without thinking of
    performance ?
    I need some better organization of my files, and need to shift some
    of my inlined functions to cpp file.
    I have to remove inline if I do that.
    Most of my inlined functions at present are one liners which returns
    a field (kind of getters ).

    Thanks
    abir

  • peter koch

    #2
    Re: can I safely ignore inline ?


    toton skrev:
    Hi,
    Can I safely ignore the inline keyword without thinking of
    performance ?
    Perhaps.
    I need some better organization of my files, and need to shift some
    of my inlined functions to cpp file.
    Why? I do not see the connection.
    I have to remove inline if I do that.
    Again: why?
    Most of my inlined functions at present are one liners which returns
    a field (kind of getters ).
    Most probably you will not see a difference. If you do, its time to
    profile and change your code based on the result.

    /Peter
    >
    Thanks
    abir

    Comment

    • Ron Natalie

      #3
      Re: can I safely ignore inline ?

      toton wrote:
      Hi,
      Can I safely ignore the inline keyword without thinking of
      performance ?
      I need some better organization of my files, and need to shift some
      of my inlined functions to cpp file.
      I have to remove inline if I do that.
      Most of my inlined functions at present are one liners which returns
      a field (kind of getters ).
      >
      Almost.

      Inline does two things.

      1. It gives the compiler a hint that performance might be increased by
      inlining this function.

      2. (THIS IS WHAT YOU MUST NOTICE) It allows the function to be
      multiply defined yet identically defined without error.

      Comment

      • Charlie

        #4
        Re: can I safely ignore inline ?

        On 12 Dec 2006 06:22:15 -0800, "toton" <abirbasak@gmai l.comwrote:
        >Hi,
        Can I safely ignore the inline keyword without thinking of
        >performance ?
        I need some better organization of my files, and need to shift some
        >of my inlined functions to cpp file.
        I have to remove inline if I do that.
        Most of my inlined functions at present are one liners which returns
        >a field (kind of getters ).
        >
        >Thanks
        >abir
        Depends on the compiler, really. Most compilers ignore 'inline'
        completely and others consider it a suggestion. Just because it is
        there doesn't mean the compiler is actually going to do it. With the
        newer compilers it is better to just let them decide anyway since they
        know best. :)

        Comment

        Working...