D's Newfangled Name Mangling

Rainer Schuetze r.sagitario at gmx.de
Thu Dec 21 08:55:42 UTC 2017



On 20.12.2017 19:42, Johan Engelen wrote:
> On Wednesday, 20 December 2017 at 13:57:20 UTC, Mike Parker wrote:
>> Many thanks to Rainer for his insightful new article for the D Blog 
>> outlining the new name mangling algorithm.
> 
> Nice!

Thanks.

> 
> "D and C++ avoid this problem by adding more information to the symbol 
> name, i.e. they encode into a symbol name the scope in which the symbol 
> is defined, the function argument types, and the return type. "
> 
> I would change it to "... and the return type (D only)". C++ does not 
> include the return type in the mangle for normal functions (it does for 
> templates). An important difference, concerning the earlier remark about 
> programs crashing when "fail to update and recompile all source files 
> that use the new declarartion"

AFAICT that's for the Itanium C++ ABI only, the VC mangling always 
encodes the return type, too.

I also noticed that gcc doesn't encode the inferred type of an "auto" 
return type for templates (available with C++17; or was it in C++14 
already?).


More information about the Digitalmars-d-announce mailing list