Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5933841
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:01:49+00:00 2026-05-22T15:01:49+00:00

Lately I have started to put more and more functions into header files, mostly

  • 0

Lately I have started to put more and more functions into header files, mostly for convenience. But I fear I might be overdoing it, my headers are full of includes and I’m not sure if that’s a good idea.

What are your rules of thumb for moving functions out of or into header files?

In case you’re wondering, I’m talking about developing applications, not libraries.

Edit:

I guess it’s helpful if I outline the pros/cons of inline (naturally) header functions versus implementation functions from my point of view:

Pro inline:

  • More clean/concise.
  • No need for signature duplication.
  • No need to change any Makefile to link against new files.
  • Instant ability to introduce template parameters.

Contra inline:

  • Increased compile time (I don’t care that much)
  • Many includes in headers (Shouldn’t be such a big issue if they use guards)

According to that, it seems like a good idea to put pretty much every function in headers, and I believe that’s pretty close to what the STL and Boost are doing (although those are libraries, as opposed to my code).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T15:01:50+00:00Added an answer on May 22, 2026 at 3:01 pm

    One of my most inviolable rules: only function bodies which are inline are allowed in header files. Anything else is asking for trouble with multiple definitions in the link phase.

    Headers should be left predominantly for declarations rather than definitions. I have exceptions to that rule (being the flexible type) but none of them involve non-inlined function bodies.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I always thought I understood how this works...but lately I have started really using
My background is primarily as a Java Developer, but lately I have been doing
I have been trying to learn more about lambda expressions lately, and thought of
I have been doing some java development lately and have started using Eclipse. For
I am a PHP and PERL coder and lately I have started feeling that
I've been doing a lot of work with Flex/Flash/Away3D lately, and have started looking
I started on a little toy project in C lately and have been scratching
Lately I have seen a lot of blog posts concerning how to build loosely
Lately all modern programming languages have a definitive web site to support, distribute, learn
I have been researching and playing with functional programming lately, solely to broaden my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.