#include <iostream>
void myFunction() {
std::cout << "Line number: " << __LINE__ << std::endl;
std::cout << "File name: " << __FILE__ << std::endl;
// 在C++98和C++03中
std::cout << "Function name: " << __FUNCTION__ << std::endl;
// 在C++11及以后版本中,可以考虑使用 __PRETTY_FUNCTION__
// std::cout << "Function signature: " << __PRETTY_FUNCTION__ << std::endl;
}
int main() {
myFunction();
return 0;
}
__LINE__, __FILE__, __FUNCTION__
最新推荐文章于 2024-05-22 14:31:52 发布