C++ Logo

std-proposals

Advanced search

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

From: sasho648 <sasho648_at_[hidden]>
Date: Thu, 4 May 2023 20:26:42 +0300
Well just require an implementation to use the inline version, if it's
available.

On Thu, May 4, 2023 at 8:19 PM Sebastian Wittmeier via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> There is no guarantee that inline functions are actually inlined.
>
> They could even be inlined sometimes within a TU (hot code path) and
> sometimes call a function, which is shared between TUs.
>
> It could generally lead to hard-to-find bugs, if the function definitions
> would be different, depending on who calls the function.
>
>
> -----Ursprüngliche Nachricht-----
> *Von:* sasho648 via Std-Proposals <std-proposals_at_[hidden]>
> *Gesendet:* Do 04.05.2023 19:12
> *Betreff:* [std-proposals] Drop same sequence of tokens for inline
> *An:* std-proposals_at_[hidden];
> *CC:* sasho648 <sasho648_at_[hidden]>;
> 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++.
>
> Like I don't see a reason requiring inline functions to have the same body
> - regardless of the statement above.
>
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>

Received on 2023-05-04 17:26:54