Thread: When to inline your *tors

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,612
    In your original post you don't seem to mention a case where inlining ctors and dtors is detrimental. Inlining does have drawbacks, but you can get most of the benefits by doing nothing.

    I rarely if ever bother to inline constructors or destructors simply because if I wrote them, they have work to do, and the overhead from a function call is probably the last thing I worry about when I go to optimize.

  2. #2
    Kung Fu Kitty Angus's Avatar
    Join Date
    Oct 2008
    Location
    Montreal, Canada
    Posts
    115
    Quote Originally Posted by citizen View Post
    In your original post you don't seem to mention a case where inlining ctors and dtors is detrimental. Inlining does have drawbacks, but you can get most of the benefits by doing nothing.

    I rarely if ever bother to inline constructors or destructors simply because if I wrote them, they have work to do, and the overhead from a function call is probably the last thing I worry about when I go to optimize.
    That's because the reasons why you shouldn't use inlining for *tors are classic problems, and beyond the scope of this thread. I wanted to deal with situation where inlining is definitely worthwhile (with certain specified exceptions).

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Code review
    By Elysia in forum C++ Programming
    Replies: 71
    Last Post: 05-13-2008, 09:42 PM
  2. Inline functions and inheritance
    By hpy_gilmore8 in forum C++ Programming
    Replies: 3
    Last Post: 01-14-2004, 06:46 PM
  3. Certain functions
    By Lurker in forum C++ Programming
    Replies: 3
    Last Post: 12-26-2003, 01:26 AM
  4. bit shifting
    By Nor in forum C++ Programming
    Replies: 9
    Last Post: 08-08-2003, 11:55 AM
  5. Replies: 5
    Last Post: 09-17-2001, 06:18 AM

Tags for this Thread