这样也可以!

「已注销」 「已注销」 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
读别人的代码,发现了这个现象。竟然能这样!正常执行无误。野指针不野。 环境是VS2012下(据说VC6也可以)
#include "stdafx.h"
#include <process.h>

class test
{
public:
int b;
void fun() ;
};

void test::fun()
{
int a = 99;
//b = 1; //运行时出错。
printf("This is a Test! \n\r");
}

class test* p = 0;

int _tmain(int argc, _TCHAR* argv[])
{
p->fun();
((class test*)(NULL))->fun();
((class test*)(67))->fun();
system("pause");
return 0;
}
...全文

相关推荐

评论 9
收藏 已收藏
分享
返回顶部
「已注销」
C++ 语言 65,214 成员 250,514 内容