- 实例
//C语言版:
printf("%s: %d", __FILE__, __LINE__);
//C++版:
cout << "Bad error < " << __FILE__ << ", Funcion:" << __FUNCTION__ << ", Line: " << __LINE__ << " >" << endl;
将会出现清晰明了的调试信息,例如上述cout的输出结果如下:
- 更多内置宏
//C语言版:
printf("%s: %d", __FILE__, __LINE__);
//C++版:
cout << "Bad error < " << __FILE__ << ", Funcion:" << __FUNCTION__ << ", Line: " << __LINE__ << " >" << endl;
将会出现清晰明了的调试信息,例如上述cout的输出结果如下: