Tag: line

_LINE__在内联函数中的行为

我有一个宏将行号和文件名传递给error handling程序: #define SYSTEM_FAILURE (error_code, comment) \ System_Failure((error_code), (comment), __LINE__, __FILE__); 在内联函数中使用时,如何解析__LINE__ ? file.h: inline int divide(int x, int y) { if (y == 0) { SYSTEM_FAILURE(ENUM_DIVIDE_BY_ZERO, “divide by zero error”); } return x/y; } __LINE__包含头文件中的行号,或者调用内联函数的源文件的行号(假设编译器在源代码中执行“粘贴”)?