Skip to content

Conversation

@zavorka
Copy link

@zavorka zavorka commented Oct 25, 2021

As the 'inline' designation is merely a hint for a compiler, an inline function might likely actually end up being compiled on its own, in which case, the linkage specifiers become significant. Therefore, one has to be prepared for such eventuality: you can either declare the function 'static' and have it be compiled in each translation unit separately, or redeclare it with 'extern' in one translation unit. Another option is to inline it forcefully with always_inline attribute. Either way, it has to be dealt with.

Note: the inline keyword behaves differently in C++ than in C99/C11.

Fixes #181, #185

As the 'inline' designation is merely a hint for a compiler, an inline
function might likely actually end up being compiled on its own, in
which case, the linkage specifiers become significant. Therefore, one
has to be prepared for such eventuality: you can either declare the
function 'static' and have it be compiled in each translation unit
separately, or redeclare it with 'extern' in one translation unit.
Another option is to inline it forcefully with `always_inline`
attribute. Either way, it has to be dealt with.

Note: the `inline` keyword behaves differently in C++ than in C99/C11.

Fixes prusa3d#181, prusa3d#185
@mkbel mkbel requested a review from DRracer October 25, 2021 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error message when compiling

1 participant