看了下面這個例子你肯定會驚嘆GOTO語言原來可以這樣用啊,呵呵。
#include
#include
using namespace std;
class B{
public:
B(){
cout << "BBBBBBBBBBBB" < };
~B(){
cout << "SHB" << endl;
};
protected:
private:
};
int func(...){
cout << "EN";
return 0;
};
int main (int argv,char* argc[]){
char * str_1 = "HelloTEST";
char str_2[200] ;
func(1,"ABC",false);
memset(str_2,’F’,200);
strcpy(str_2,str_1);
const int ** p;
int * const *q;
while(1)
{
B b;
//goto HEIHEI; 屏蔽掉goto 和開啟goto 看看 B的析構(gòu)函數(shù)是怎么跑的,能正確析構(gòu)嗎?goto都干了什么。
}
HEIHEI: int ABC = 0;
return 0;
}
#include
#include
using namespace std;
class B{
public:
B(){
cout << "BBBBBBBBBBBB" <
~B(){
cout << "SHB" << endl;
};
protected:
private:
};
int func(...){
cout << "EN";
return 0;
};
int main (int argv,char* argc[]){
char * str_1 = "HelloTEST";
char str_2[200] ;
func(1,"ABC",false);
memset(str_2,’F’,200);
strcpy(str_2,str_1);
const int ** p;
int * const *q;
while(1)
{
B b;
//goto HEIHEI; 屏蔽掉goto 和開啟goto 看看 B的析構(gòu)函數(shù)是怎么跑的,能正確析構(gòu)嗎?goto都干了什么。
}
HEIHEI: int ABC = 0;
return 0;
}