Namespaces
Variants
Actions

如何获取当前函数的名称

Jump to: navigation, search
文章信息

文章
huwell 在 02 Jul 2007 创建
最后由 hamishwillee 在 15 Dec 2011 编辑
  • 设备, 软件 版本:

S60 3rd Edition


  • 详细描述:

有时候debug时为了记录相关信息,我们需要知道当前函数的名称,这时可以通过__func__来获取。

    void LogFunctionName(const char* name)
{
RDebug::Printf("current function: %s\n", name);
}


现在,我们可以通过如下语句打印出函数名:

    LogFunctionName(__func__);
This page was last modified on 15 December 2011, at 12:59.
82 page views in the last 30 days.
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved