On 1/28/22 16:17, Siarhei Siamashka wrote:
> On Friday, 28 January 2022 at 23:43:00 UTC, H. S. Teoh wrote:
>> You don't have to rely on any opinions. Try it out yourself and find
>> out for sure.
>
> I guess, my problem and the source of all confusion is that I'm way too
> used to developing C++ code.

I am confused too. Weak symbols are a concept beyond D and C++ so it should be the same with C++. Testing, the following C++ program does compile foo<int> as a weak symbol as well:

template <class T>
void foo() {
}

int main() {
  foo<int>();
}

> And in the C++ ecosystem your
> recommendation is a recipe for disaster.

And it is.

> It's absolutely necessary to
> have perfect understanding about what's going on and which guarantees
> are provided.

Good luck with that. :) There aren't many people who know what linkers and loaders actually do.

> Accidentally relying on undefined behavior will backfire,
> because [Murphy's law](https://en.wikipedia.org/wiki/Murphy%27s_law) is
> unfortunately very real.

Yes.

What Johan said makes the most sense to me: The onus of ensuring ODR is on the user. Given the state of languages and linkers, I have to ensure that.

Ali

Reply via email to