我有一個奇怪的行爲與對象分配。如果你能解釋爲什麼這項任務能像這樣工作,我將非常感激。這花了我很多時間。 我正在使用Visual Studio Enterprise 2017(所有默認設置)。 代碼: #include "stdafx.h"
#include <iostream>
using namespace std;
class Test
{
public:
Test(
是否有任何障礙妨礙weakref做所有__del__所做的一切,但有更強的保證(例如,finalize保證在解釋器退出之前進行調用,並且調用順序已定義良好等)? 看來,在遙遠的過去it was thoughtweakref最終將導致從語言中刪除__del__。 是什麼阻止了這種情況發生? 似乎有few use cases for __del__,我知道所有的人似乎至少工作(通常好得多)與weakr
我寫了這個分析類及其對內存釋放效應的析構函數的行爲,但結果似乎是有點令人驚訝的對我說: class test {
public:
test() {}
~test() {} //<-----Run the program once with and once without this line.
};
int main()
{
test x;
tes