gdc or ldc for faster programs?
Siarhei Siamashka
siarhei.siamashka at gmail.com
Thu Jan 27 20:28:40 UTC 2022
On Thursday, 27 January 2022 at 18:12:18 UTC, Johan Engelen wrote:
> But the language requires ODR, so we can emit templates as
> weak_odr, telling the optimizer and linker that the symbols
> should be merged _and_ that ODR can be assumed to hold (i.e.
> inlining is OK).
Thanks! This was also my impression. But the problem is that Iain
Buclaw seems to disagree with us. He claims that template
functions must be overridable by global functions and this is
supposed to inhibit template functions inlining. Is there any
independent source to back up your or Iain's claim?
> The onus of honouring ODR is on the user - not the compiler -
> because we allow the user to do separate compilation.
My own limited experiments with various code snippets convinced
me that D compilers actually try their best to prevent ODR
violation, so it isn't like users can easily hurt themselves:
https://forum.dlang.org/thread/cstjhjvmmibonbajwbbl@forum.dlang.org
Also module names are added as a part of function names mangling.
Having an accidental clash of symbol names shouldn't be very
likely in a valid D project. Though I'm not absolutely sure
whether this provides a sufficient safety net.
More information about the Digitalmars-d-learn
mailing list