天天看点

宏"__FUNCTION__" 和" __LINE__ "

__FUNCTION__,当前函数名,类型char const*

__LINE__, 在单前文件中的行,类型int

用于日志中,方便查错。例如:

void

func()

{

printf

(

"source line %d, in function %s"

,__LINE__,__FUNCTION__);

}

int

main()

func();

return

0;