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 8242579
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T21:13:00+00:00 2026-06-07T21:13:00+00:00

I always try to keep implementation outside of headers, so for templates and inlined

  • 0

I always try to keep implementation outside of headers, so for templates and inlined functions, I usually do something like this


// File.h
inline bool foo()

#include "File.hpp"

// File.hpp

inline bool foo()
{
    return 1;
}

My question is, what does the C++ specification have to say about repeating the inline keyword for the actual implementation of the function? (as shown in this example)

I don’t really want to do that as it gets messy with lots and lots of functions, and while my compiler doesn’t complain, I wonder if the compiler still accepts the inline hint.

Anyone know?

  • 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-06-07T21:13:03+00:00Added an answer on June 7, 2026 at 9:13 pm

    I tend to put inline as far from the interface as possible since it is an implementation detail and not part of the interface. Hence: omit the first inline in the declaration. And only attach it to the function definition. For the inclusion of an hpp compiler scopes are irrelevant in respect to inline since the files are treated as concatenated.
    See also http://www.parashift.com/c++-faq/where-to-put-inline-keyword.html for a more detailed explanation.

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

Sidebar

Related Questions

this error is always fired, when i'm try to free my allocated struct the
I use External JavaScripts in a website as I always try to keep JavaScript
I will try and keep this short and to the point. Given the following
I try to upload an update for my app. However I always get this
So I've just written this implementation for a type that abstracts a file and
ok this is a head wrecker and I will try to keep it brief.
Ok, so this is actually quite a long story, but i'll try and keep
I've been scouring the IBM docs to try to find this but I keep
Whenever I use WCF, I always try to make immutable classes that end up
When I try to initialize an object using the Object Initializer, ReSharper always inserts

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.