C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Drop same sequence of tokens for inline

From: Jason McKesson <jmckesson_at_[hidden]>
Date: Thu, 4 May 2023 18:05:29 -0400
On Thu, May 4, 2023 at 1:12 PM sasho648 via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>
> So why does inline functions need to have the same sequence of tokens in different TU - imagine in a TU there is a preprocessor define that changes the function definition - it would make sense this not to be UB.
>
> In C inline functions have internal linkage - it would make the same sense for C++.

Is there some reason why those functions can't just be declared
`static`? If you want internal linkage, we have a way to do that.
There's no reason to force internal linkage on a construct that does
not strictly *need* it.

Also, let's not forget that every template function and every class
member function defined within the class (unless in the purview of a
module) is implicitly `inline`. Should they also have static linkage
implicitly?

Received on 2023-05-04 22:05:41