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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T02:51:22+00:00 2026-06-03T02:51:22+00:00

Iam programing in C. I want some description about static and inline functions. I

  • 0

Iam programing in C. I want some description about static and inline functions. I know that if we make a function static then it is an indication to compiler that it is under internal linkage for only one translation unit.
I have following doubts regarding static and inline :

  1. If we make a function as static , can we use it in other translation units …i.e in other .c files? If yes ..how?
  2. If we make the function as static inline what is the difference then ? How it will be treated by the compiler ?
  3. Does making a function as static gives the same effect as a macro?
  4. Treating a function to be inline is dependent on the compiler depending on the size . So is there any way that we can forcefully make it to be treated like inline?
  5. How we can use inline and static functions for optimization ?

Please shed some light on the above things inline.
Platform is Linux, gcc compiler , C language.

  • 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-03T02:51:23+00:00Added an answer on June 3, 2026 at 2:51 am
    1. A static function can’t be used in other translation units. That’s their raison d’être.

    2. inline hints to the compiler that the function should be inlined instead of called.

    3. Making a function static is different than using a macro. A macro essentially overrules the compiler. Whether it thinks it wise to inline or not, a macro will be inlined; macros are textual substitution. You can also pass a static function to something requiring a function pointer. Can’t do that with a macro.

    4. Macros will forcefully inline anything. Even specifying inline can be overruled.

    5. Make functions you don’t want to export static. If a function is really small, and you really think it should be inlined, you can tell the compiler that with inline. Macros are really only for metaprogramming. The compiler knows better than you.

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

Sidebar

Related Questions

guys I want to start programing with C++. I have written some programs in
Lately I have come to realize that I should know some of Java for
I want to start developing graphic programing using OpenGl To kick start I am
Iam new to c programming and needs some help. long *taskids[NUM_THREADS]; for(t=0; t<NUM_THREADS; t++)
I have a child process which generates some output of variable length and then
I got a good book on WPF but I want some code examples of
I am new in programing. I want to save images from Google Images. I
Some background info I am programming in a system that uses a proprietary programming
I have a form that has some textboxes (45) with CheckBoxes next to each,
Could some one refer me good article (PDF, web Link or Book Chapter) about

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.