Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8614209
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T05:04:09+00:00 2026-06-12T05:04:09+00:00

I am to find that I cannot use as a valid identifier with g++

  • 0

I am to find that I cannot use as a valid identifier with g++ 4.7, even with the -fextended-identifiers option enabled:

int main(int argc, const char* argv[])
{
  const char*  = "I'm very happy";
  return 0;
}

main.cpp:3:3: error: stray ‘\360’ in program
main.cpp:3:3: error: stray ‘\237’ in program
main.cpp:3:3: error: stray ‘\230’ in program
main.cpp:3:3: error: stray ‘\203’ in program

After some googling, I discovered that UTF-8 characters are not yet supported in identifiers, but a universal-character-name should work. So I convert my source to:

int main(int argc, const char* argv[])
{
  const char* \U0001F603 = "I'm very happy";
  return 0;
}

main.cpp:3:15: error: universal character \U0001F603 is not valid in an identifier

So apparently isn’t a valid identifier character. However, the standard specifically allows characters from the range 10000-1FFFD in Annex E.1 and doesn’t disallow it as an initial character in E.2.

My next effort was to see if any other allowed Unicode characters worked – but none that I tried did. Not even the ever important PILE OF POO () character.

So, for the sake of meaningful and descriptive variable names, what gives? Does -fextended-identifiers do as it advertises or not? Is it only supported in the very latest build? And what kind of support do other compilers have?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T05:04:10+00:00Added an answer on June 12, 2026 at 5:04 am

    As of 4.8, GCC does not support characters outside of the BMP used as identifiers. It seems to be an unnecessary restriction. Also, GCC only supports a very restricted set of character described in ucnid.tab, based on C99 and C++98 (it is not updated to C11 and C++11 yet, it seems).

    As described in the manual, -fextended-identifiers is experimental, so it has a higher chance won’t work as expected.


    GCC supported the C11 character set starting from 4.9.0 (SVN r204886 to be precise). So OP’s second piece of code using \U0001F603 does work. I still can’t get the actual code using to work even with -finput-charset=UTF-8 with GCC 8.2 on https://gcc.godbolt.org though (You may want to follow this bug report, provided by @DanielWolf).

    Meanwhile, both pieces of code work on Clang 3.3 without any options other than -std=c++11.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When using RPostgreSQL I find that I cannot use sqldf in the same way.
i have bug that i cannot find, i have Class Point with method who
I have a relatively simple question that I cannot seem to find the answer
I've read the related questions but I cannot find one that suits my problem(or
I am learning C++ and have got a question that I cannot find the
Similar questions have been asked but cannot find a solution that works well. What
I simply cannot find how to do this. so, I have a String that
I faced a problem that I can not find a way to change the
I find that, Windows 8 will be highly HTML5 + Javascript based Metro Application
I find that I'm repeating myself alot and that is of course no good.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.