Using emoji as identifier names in c++ in Visual Studio or GCC

Since gcc 10, gcc now accepts emoji as part of the identifier names.

Source: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67224


We can see from Unicode/special characters in variable names in clang not allowed? that the C++ standard allows certain sets of extended characters. The emoji codes seem to fall into the allowed ranges.

As far as I can tell using this live example Visual Studio 2013 supports extended characters in identifiers and this is supported by the C++ Identifiers documentation:

C++ specification allows naming with Unicode-characters

And also, Visual C++ itself allows too. Not ASCII limited.

and provides link which indicates this was allowed since 2005. Although as bames53 points out there may be Windows limitations with respect emoji.

gcc on the other hand does not seem to support this except by using escape codes, from their Character sets document:

In identifiers, characters outside the ASCII range can only be specified with the ‘\u’ and ‘\U’ escapes, not used directly. If strict ISO C90 conformance is specified with an option such as -std=c90, or -fno-extended-identifiers is used, then those escapes are not permitted in identifiers.