[Issue 22839] Add equivalent of C 'static' for symbols

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Mar 5 05:54:04 UTC 2022


https://issues.dlang.org/show_bug.cgi?id=22839

Walter Bright <bugzilla at digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla at digitalmars.com

--- Comment #1 from Walter Bright <bugzilla at digitalmars.com> ---
The reason for D's behavior is that when doing metaprogramming, lots of symbols
get generated, including private ones. When doing this across multiple files,
the generated symbols are often identical, so D puts them in COMDAT sections
and the linker merges them so only one appears in the executable.

With your suggestion, the symbols would not be merged, but would be duplicated
and consuming executable file size.

This would be a significant change in behavior.

Because of this you suggest marking them differently so the names won't even
appear in the object file, and so the linker never attempts to merge them.

This hasn't come up before, so I'd like to see a compelling use case to make a
language change?

--


More information about the Digitalmars-d-bugs mailing list