[dmd-internals] Correction to name mangling doc

Sean Kelly sean at invisibleduck.org
Thu Sep 1 08:51:07 PDT 2011


The current scheme just complicates demangling if the bool should be displayed as true/false instead of 1/0. I'd have to pull the actual element type out of the Hba and pass it in as an alternate type when parsing the integer value. Since the mangled name is the same length either way, it seemed like it might be a worthwhile convenience. 

Sent from my iPhone

On Aug 31, 2011, at 5:33 PM, Walter Bright <walter at digitalmars.com> wrote:

> 
> 
> On 8/31/2011 4:18 PM, Sean Kelly wrote:
>> Here's one I ran across working on formatting integer literal template parameters.  This declaration:
>> 
>> void fnA(alias x)() {}
>> alias fnA!([true:'a',false:'b']) fn;
>> 
>> Is mangled as:
>> 
>> _D8demangle24__T3fnAVHbaA2i1i97i0i98Z3fnAFZv
>> 
>> So the template parameter type is "Hba", the list of values is "A2…" and the values themselves are all represented as integers, ie. "i1" for "true", "i97" for "a", etc.  I'm inclined to say that the mangling should reflect the actual type of the values rather than using 'i' as a catch-all.  Does anyone disagree?  Combined with the fix for AA literals, I think the encoding should be:
>> 
>> _D8demangle24__T3fnAVHba2b1a97b0a98Z3fnAFZv
>> 
> 
> As long as its decipherable, I don't see a point. Also, the mangling should be as short as practical. Spelling out 'true' is a waste.
> _______________________________________________
> dmd-internals mailing list
> dmd-internals at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/dmd-internals


More information about the dmd-internals mailing list