Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: should i use inline functions?  (Read 1854 times)

0 Members and 1 Guest are viewing this topic.

dydya-stepa

  • Jr. Member
  • **
  • Posts: 82
    • View Profile
should i use inline functions?
« on: February 28, 2012, 02:11:09 pm »
should i use inline function or the compiler will take care of it?

i noticed sfml code doesn't use it a lot

Serapth

  • Full Member
  • ***
  • Posts: 105
    • View Profile
should i use inline functions?
« Reply #1 on: February 28, 2012, 03:30:57 pm »
As a general rule, leave such decisions to the compiler until you have reason not to.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
should i use inline functions?
« Reply #2 on: February 28, 2012, 08:01:53 pm »
Serapth is right. I actually never use the inline keyword unless something must be in the header because of linkage reasons.

Generally, writing function definitions in .cpp files has the following advantages:
  • Changes in the implementation don't require clients to recompile
  • Less code must be read everywhere the header is used, speeding up compilation progress
  • Functionality on which the implementation depends can be included in the .cpp file, leading to fewer dependencies in the interface
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development: