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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T23:55:20+00:00 2026-06-12T23:55:20+00:00

Can anybody tell me what the difference is between an inline function and static

  • 0

Can anybody tell me what the difference is between an inline function and static inline function?

In which cases should I prefer static inline over inline?

I am asking this question because I have an inline function for which I am facing compilation issues during linking (relocation error:... symbol has been discarded with discarded section ...). I made it a normal function and it worked.
Now some of my seniors told me try with static inline.
Below is my function:

inline void wizSendNotifier (const char* nn_name, bpDU* arg=0, int aspect = -1)
{
   wizuiNotifier* notifier = ::wizNtrKit.getNotifier (nn_name);
   notifier->notify (arg, aspect);
}

and this not inside a class. This is inside a header file!

I guess the call to a static function should be done only in the particular TU where it is defined.

Since my function is in a header file and if i make it static, will it be the case that where ever I include that header file the static function can used used in that translation unit?

  • 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-12T23:55:21+00:00Added an answer on June 12, 2026 at 11:55 pm

    The non-static inline function declaration refers to the same function in every translation unit (source file) that uses it.

    The One Definition Rule requires that the body of the function definition is identical in every TU that contains it, with a longish definition of “identical”. This is usually satisfied provided that the source files all use the same header, and provided that the function doesn’t use any global names with internal linkage (including static functions) or any macros that are defined differently in different TUs.

    I don’t remember encountering that particular linker error before, but it’s at least possible that one of these restrictions is responsible. It’s your responsibility to satisfy the requirements: undefined behavior with no diagnostic required if you don’t.

    The static inline function declaration refers to a different function in each translation unit, that just so happens to have the same name. It can use static global names or macros that are different in different TUs, in which case the function might behave differently in the different TUs, even though its definition in the header file “looks the same”.

    Because of this difference, if the function contains any static local variables then it behaves differently according to whether it is static or not. If it is static then each TU has its own version of the function and hence its own copy of the static local variables. If it’s inline only, then there is only one copy of the static local variables used by all TUs.

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

Sidebar

Related Questions

Can anybody tell me what is the difference between standard iOS account and enterprise
can anybody tell me the difference of using '===' as if (null === $this->getName())
Can anybody tell me which View Switcher Control is this in below image.?
Can anybody tell me the difference between a INET Socket and any other socket?
Can anybody tell me the difference between far pointers and near pointers in C?
Can anybody tell me what is the difference between void fun(MyClass &mc); and void
Can anybody please tell me the exact difference between these two syntax , I
Can anybody tell me the effective difference between the following connection strings: <add key=ConnectionString
Can anybody please tell me what is the exact difference between stretching and scaling
Can anybody tell me the difference between these two JavaScript commands? Also what is

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.