/* */注释的代替
"/* */"在使用时会遇上一些不方便的地方,例如:
/*
cout << "hello~" << endl;
/*
cout << "hello~" << endl;
cout << "hello~" << endl;
*/
cout << "hello~" << endl;
*/
/*只与其遇到的第一个"*/"匹配,从而导致第7行和第8行没有被注释掉,产生一些麻烦。
遇上这种问题,可以用预处理指令来解决。
#if 0
cout << "hello~" << endl;
cout << "hello~" << endl;
cout << "hello~" << endl;
cout << "hello~" << endl;
#endif
不会产生“没有注释掉”的情况。