Date: Sun, 2 Feb 2025 19:50:00 +0000
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?
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?
Received on 2025-02-02 19:50:09