What is the meaning of symbol "vector deleting destructor" in VC++?
Asked Answered
B

2

10

This symbol seems to be a compiler generated destructor. What is the difference between this one, 'compiler generated destructor' and 'scalar deleting destructor'? Are there any other types of compiler generated ctor/dtor?

Bainite answered 26/6, 2012 at 8:54 Comment(0)
B
15

Functions named 'scalar deleting destructor' and 'vector deleting destructor' are helper functions created by VC compiler when generating code for delete statement. Don't confuse them with the class destructor which also may be generated by the compiler. The former can be expressed in pseudocode as

void scalar_deleting_destructor(A* pa)
{
pa->~A();
A::operator delete(pa);
}

and the latter as

void vector_deleting_destructor(A* pa, size_t count)
{
for (size_t i = 0; i < count; ++i)
pa[i].~A();
A::operator delete[](pa);
}
Bridgework answered 27/6, 2012 at 12:16 Comment(2)
Thanks, Andrey. I am a little confused about the inner delete operator here. This scalar deleting destructor is compiler generated and it is called by delete a, is this right? Seems the inner call to delete causes recursion?Bainite
@Bainite Let me try to make it more clear. delete a is a delete statement, i.e. a language construct, which is not to be confused with A::operator delete which is a delete operator, a function which actually deallocates the memory. I don't have the C++ standard at hand right now, I could provide references a bit later.Bridgework
B
-1

I am using visual studio MSVC 2019 and C++20 also QT6 enter image description here

I have here in Windows with MSVC unresolved external symbol "public: virtual void * __cdecl QSslSocket::`vector deleting destructor'(unsigned int)" (??_EQSslSocket@@UEAAPEAXI@Z).

Buxom answered 5/7, 2023 at 9:14 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.