C++ Logo

std-proposals

Advanced search

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

From: sasho648 <sasho648_at_[hidden]>
Date: Thu, 4 May 2023 21:19:48 +0300
---------- Forwarded message ---------
From: sasho648 <sasho648_at_[hidden]>
Date: Thu, May 4, 2023 at 9:19 PM
Subject: Re: [std-proposals] Drop same sequence of tokens for inline
To: Jonathan Wakely <cxx_at_[hidden]>


Well we could add wording for that specific case.

On Thu, May 4, 2023 at 9:12 PM Jonathan Wakely <cxx_at_[hidden]> wrote:

>
>
> On Thu, 4 May 2023 at 18:27, sasho648 via Std-Proposals <
> std-proposals_at_[hidden]> wrote:
>
>> I mean the one available in current TU.
>>
>
> And then you break every inline function that uses a local static variable.
>
>
>
>>
>> On Thu, May 4, 2023 at 8:26 PM sasho648 <sasho648_at_[hidden]> wrote:
>>
>>> 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
>>>>
>>> --
>> Std-Proposals mailing list
>> Std-Proposals_at_[hidden]
>> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>>
>

Received on 2023-05-04 18:20:00