__func__
(C++11) The predefined identifier __func__
is implicitly defined as a string that contains the unqualified and unadorned name of the enclosing function. __func__
is mandated by the C++ standard and is not a Microsoft extension.
Syntax
__func__
Return Value
Returns a null-terminated const char array of characters that contains the function name.
Example
#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;
}
Requirements
C++11
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for