cbor-cpp icon indicating copy to clipboard operation
cbor-cpp copied to clipboard

log.h __PRETTY_FUNCTION__ is not supported in Visual Studio

Open bialix opened this issue 9 years ago • 1 comments

Trying to compile your library under Visual Studio - I was forced to change your log.h to use just plain __FUNCTION__ macro instead of __PRETTY_FUNCTION__.

Search on MSDN revealed this: https://social.msdn.microsoft.com/Forums/vstudio/en-US/02c69018-a182-48b3-94d1-250252aa00a7/prettyfunction?forum=vclanguage

bialix avatar Apr 12 '16 08:04 bialix

__PRETTY_FUNCTION__ is a gcc extension. In Visual C++ you can use __FUNCSIG__ which isn't quite identical to __PRETTY_FUNCTION__ extension.

VC++ :

// Demonstrates functionality of __FUNCTION__, __FUNCDNAME__, and __FUNCSIG__ macros
void exampleFunction()
{
	printf("Function name: %s\n", __FUNCTION__);
	printf("Decorated function name: %s\n", __FUNCDNAME__);
	printf("Function signature: %s\n", __FUNCSIG__);
	
	// Sample Output
	// -------------------------------------------------
	// Function name: exampleFunction
	// Decorated function name: ?exampleFunction@@YAXXZ
	// Function signature: void __cdecl exampleFunction(void)
}

Reference : MSDN

etanot avatar Oct 16 '18 02:10 etanot