灵活使用GOTO语句 |
|
www.nanhushi.com 佚名 不详 |
看了下面这个例子你肯定会惊叹GOTO语言原来可以这样用啊,呵呵。 #include <string> #include <iostream> using namespace std; class B{ public: B(){ cout << "BBBBBBBBBBBB" <<endl; }; ~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的析构函数是怎么跑的,能正确析构吗?goto都干了什么。 } HEIHEI: int ABC = 0; return 0; }
|
|
|
文章录入:杜斌 责任编辑:杜斌 |
|
上一篇文章: 用C语言封装的链表的方法 下一篇文章: 防止窗口闪烁的方法 |
【字体:小 大】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口】 |
|
|