Date: Sun, 2 Feb 2025 20:52:46 +0000
On Sun, Feb 2, 2025 at 8:01 PM Jeremy Rifkin wrote:
>
> Most people would never care about the mangled name and demangles are easy to use.
It would be useful where two types are identical but you want to give
them different names, for example:
typedef vector<int> IntVec;
typedef vector<int> CollectionOfSerialNumbers <=>
mangle("CollectionOfSerialNumbers");
This will make it easy to differentiate overloaded functions:
void Func(IntVec &);
void Func(CollectionOfSerialNumbers &);
> > What if the original typedef could be rewritten as:
> > typedef vector<int> IntVec <=> mangle("IntVec");
>
> This wouldn't work, it would break ABI.
Assume there's no previous ABI and that IntVec is a new type. Can't
break ABI if there's no old ABI to break.
> > class IntVec : public vector<int> <=> mangled("SomeOtherName")
>
> Why would you need to do that if you could specify the mangling of your typedef?
I was just showing that any given class could be given a custom
mangled name, but yeah you're right that there's no reason why a
programmer would inherit from vector and also specify a custom mangled
name.
>
> Most people would never care about the mangled name and demangles are easy to use.
It would be useful where two types are identical but you want to give
them different names, for example:
typedef vector<int> IntVec;
typedef vector<int> CollectionOfSerialNumbers <=>
mangle("CollectionOfSerialNumbers");
This will make it easy to differentiate overloaded functions:
void Func(IntVec &);
void Func(CollectionOfSerialNumbers &);
> > What if the original typedef could be rewritten as:
> > typedef vector<int> IntVec <=> mangle("IntVec");
>
> This wouldn't work, it would break ABI.
Assume there's no previous ABI and that IntVec is a new type. Can't
break ABI if there's no old ABI to break.
> > class IntVec : public vector<int> <=> mangled("SomeOtherName")
>
> Why would you need to do that if you could specify the mangling of your typedef?
I was just showing that any given class could be given a custom
mangled name, but yeah you're right that there's no reason why a
programmer would inherit from vector and also specify a custom mangled
name.
Received on 2025-02-02 20:52:55