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

  • SEARCH
  • Home
  • 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 8970963
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:50:20+00:00 2026-06-15T17:50:20+00:00

My question regarding underscores in names is partly answered here, but either the answer

  • 0

My question regarding underscores in names is partly answered here, but either the answer is incomplete or I do not fully understand it.

Sect. 2.14.8.7 of the C++11 standard declares this literal operator as an example:

long double operator "" _w(long double);

Besides declaring the operator, the standard and its example do two further things that, if viewed separately, each make sense:

  • it begins the name _w with an underscore; and
  • it puts the operator in the global namespace.

My question has two parts:

  1. According to the answer linked above, the name _w is not an identifier, or the identifier _w is not a name, or … well, I’m confused.
  2. If _w is okay, then is the capitalized _W okay, too — as in 60.0_W, meaning 60.0 watts? Or is the preprocessor likely to mishandle the capitalized version?

Undoubtedly like you, I am not in the habit of starting global names with underscores, a habit the standard’s sect. 17.6.4.3.2.1 explicitly seems to deprecate. Therefore, if you can cast some additional light on the matter of underscores, names and literal operators, the light would be appreciated.

  • 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-15T17:50:22+00:00Added an answer on June 15, 2026 at 5:50 pm

    Alright, I checked back with Richard Smith from the Clang team, and the _W part in your literal operator is indeed not a reserved identifier and/or name and it is also a seperate preprocessor token which will get expanded if it names a macro. This is in accordance with the standard subclauses 2.5, where an identifier is a preprocessor-token, and 2.2 which has macro expansion as part of phase 4, before preprocessor-tokens are replaced with just tokens of the language grammar, which happens in phase 7.

    He also mentioned that, since the Portland meeting of the committee, you can say operator""_W, which will prevent macro expansion, since the _W is not a single identifier anymore. Clang trunk already implements this and compiles the following snippet:

    #define _W _x
    
    int operator""_W(unsigned long long){ return 42; }
    
    int main(){
      int i = 1337_W;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

One question regarding whether the following code should yield a compiler warning or not
I have a question regarding FLWOR joins. Here's an overview of how my XMLs
Quick question regarding Google Maps. I have one fully working Google Maps project and
Here's a simple question regarding const correctness. I have this class: template <class T>
Question regarding GtkBuilder. When we unref builder pointer does it destroys all the screens/widgets
Question regarding fluent nHibernate table mappings: Apparently I was under the mistaken impression, that
Quick question regarding memory management in C++ If I do the following operation: pointer
simple question regarding property value inheritance in UserControls. If i create a UserControl, it
Quick question regarding delegateEvents in a View - can we specify multiple event bindings
i have a question regarding the AsyncTask class in android, and why it is

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.