在调试字符串的函数中如何获取函数名? [英] How to get the function name while in a function for debug strings?

查看:115
本文介绍了在调试字符串的函数中如何获取函数名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在每次调用时输出函数名称,我可以轻松地复制并粘贴函数名称,但是我想知道是否有快捷方式可以为我做这个工作?

I want to output the function name each time it is called, I can easily copy and paste the function name, however I wondered if there was a shortcut that would do the job for me?

目前我正在做:

SlideInfoHeader* lynxThreeFile::readSlideInfoHeader(QDataStream & in)
{
    qDebug("lynxThreeFile::readSlideInfoHeader");
} 

但我想要的是一般的:

SlideInfoHeader* lynxThreeFile::readSlideInfoHeader(QDataStream & in)
{
    qDebug(this.className() + "::" + this.functionName());
}


推荐答案

__ FUNCTION __ 由MSVC和GCC支持,并应提供您需要的信息。

"__FUNCTION__" is supported by both MSVC and GCC and should give you the information you need.

这篇关于在调试字符串的函数中如何获取函数名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆