Partager via


__func__

(C++11) L’identificateur __func__ prédéfini est implicitement défini en tant que chaîne qui contient le nom non qualifié et non qualifié de la fonction englobante. __func__ est mandaté par la norme C++ et n’est pas une extension Microsoft.

Syntaxe

__func__

Valeur de retour

Retourne un tableau de caractères const avec fin null qui contient le nom de la fonction.

Exemple

#include <string>
#include <iostream>

namespace Test
{
    struct Foo
    {
        static void DoSomething(int i, std::string s)
        {
           std::cout << __func__ << std::endl; // Output: DoSomething
        }
    };
}

int main()
{
    Test::Foo::DoSomething(42, "Hello");

    return 0;
}

Spécifications

C++11