Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

8
  • Thanks! Aside from potentially wasting space if the compiler doesn't inline, does using static also have the side effect of making making it impossible to compare function pointers to the function from different translation units? Commented Jun 19, 2020 at 21:11
  • @Evan: Yes, it makes the function pointers non-equal because they're different functions. Commented Jun 19, 2020 at 21:43
  • if you inline a function (I mean, if the compiler inlines it) you waste space anyway, because you have a copy of the function code at every call point. Commented Jun 27, 2020 at 19:49
  • @Luis: The function body is just a function call, which you already have if the function is out-of-line. Commented Jun 27, 2020 at 20:31
  • 1
    @LuisColorado: Sorry, I thought this comment thread was on a different but similar question. Nonetheless, whether to make the function inline is not the question here. The question is just how to do it correctly. So I don't think our discussion is on-topic. Commented Jun 30, 2020 at 20:46