Can I default a function argument to the value of __FILE__ at the caller?

别等时光非礼了梦想. 提交于 2019-12-05 04:38:48

You can't, but you can acheive this behavior with an additional macro. For instance:

#DEFINE THROW(e) throwException(e, __FILE__, __LINE__);

On a side note, __PRETTY_FUNCTION__ is not standard.

No. Macros are expanded at the source line where they occur.

You probably can... but definitely not with the restriction you mentioned (no macros).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!