I am using Visual Studio 2017 and I set the project to use ISO C++14 Standard under C/C++->Languages
The debugger cannot recognize __func__
predefined identifier and it crashes if I try to use it as a string with error:
: Access violation reading location 0xFFFFFFFFFFFFFFFF
What am I missing to be able to use this identifier?
Code sample if needed
printf("%S\n", __func__);
Thanks
static const char __func__[];
printf()
with a capital S
as a conversion specifier is an extension that requires a wchar_t*
.
Solution, use a lowercase s
:
printf("%s\n", __func__);
or
std::cout << __func__ << '\n';