GCC, Unicode, and __FUNCTION__

I am trying to compile my project under GCC (Visual Studio compiles it flawlessly).

I have an assert user-defined function that throws a wstring message. Its part is the __FUNCTION__ macro, which I "unicode" using the WIDEN macro from MSDN

#define WIDEN2(x) L ## x
#define WIDEN(x) WIDEN2(x)

It compiles to MSVC, but it prints this to GCC:

error: ‘L__FUNCTION__’ was not declared in this scope

The only solution I could come up with is to convert the contents of __FUNCTION __ to wstring at runtime using mbstowcs, but I would like to find a compilation method for this.

Thanks for the help.

+5
source share
1 answer

GCC __FUNCTION__uses a custom extension. Quote: GCC Online Docs

GCC 3.3 , C, __FUNCTION__ __PRETTY_FUNCTION__ ; O char, . GCC 3.4 , __func__. ++, __FUNCTION__ __PRETTY_FUNCTION__ .

, L __FUNCTION__ L__FUNCTION__, , , undefined.

+5

All Articles