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@lists.isocpp.org>
Gesendet: Do 04.05.2023 19:12
Betreff: [std-proposals] Drop same sequence of tokens for inline
An: std-proposals@lists.isocpp.org;
CC: sasho648 <sasho648@gmail.com>;
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@lists.isocpp.org https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals