C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Specify the mangled name

From: Jeremy Rifkin <rifkin.jer_at_[hidden]>
Date: Sun, 2 Feb 2025 14:01:37 -0600
Hi,
This would be a really weird language feature and I don't think it would be
particularly useful or helpful.

I'm dubious of the claim that people would do this in any widespread way.
Most people would never care about the mangled name and demangles are easy
to use. Any half-decent debugger will demangle symbols automatically, fwiw.

> What if the original typedef could be rewritten as:
> typedef vector<int> IntVec <=> mangle("IntVec");

This wouldn't work, it would break ABI.

> class IntVec : public vector<int> <=> mangled("SomeOtherName")

Why would you need to do that if you could specify the mangling of your
typedef?

Cheers,
Jeremy

On Sun, Feb 2, 2025 at 1:50 PM Frederick Virchanza Gotham via Std-Proposals
<std-proposals_at_[hidden]> wrote:

> A few days ago here on the mailing list, a person posted that some
> programmers are avoiding doing:
>
> typedef vector<int> IntVec;
>
> and instead are doing:
>
> class IntVec : public vector<int> {
> . . .
> };
>
> simply because the former gets mangled to something horrible, and the
> latter gets mangled to something that is easy to spot in the debugger.
>
> The C++ Standard doesn't mention the word 'mangle', however it is at
> least on some level aware of mangling because you can write "extern C"
> to tell the compiler not to mangle a name -- or at least to mangle it
> the way it would get mangled if it were C instead of C++.
>
> What if the original typedef could be rewritten as:
>
> typedef vector<int> IntVec <=> mangle("IntVec");
>
> And also when declaring or defining a class as follows:
>
> class IntVec <=> mangled("SomeOtherName");
>
> class IntVec : public vector<int> <=> mangled("SomeOtherName") {
> . . .
> };
>
> Would this be useful in C++29?
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>

Received on 2025-02-02 20:01:51