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 8361585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T11:43:55+00:00 2026-06-09T11:43:55+00:00

I’m moving some code over to GCC 4.7 (from 4.6) and ran into a

  • 0

I’m moving some code over to GCC 4.7 (from 4.6) and ran into a few compiler errors and found the problem documented in the GCC 4.7 porting guide:

User-defined literals and whitespace

The C++ compiler in ISO C11 mode std={c++11,c++0x,gnu++11,gnu++0x}
supports user defined literals, which are incompatible with some valid
ISO C++03 code.

In particular, whitespace is now needed after a string literal and
before something that could be a valid user defined literal. Take the
valid ISO C++03 code

const char *p = "foobar"__TIME__;

In C++03, the TIME macro expands to some string literal and is
concatenated with the other one. In C++11 __TIME__ isn’t expanded,
instead operator "" __TIME__ is being looked up, resulting in the
following diagnostic:

error: unable to find string literal operator  ‘operator"" __TIME__’

This applies to any string literal followed without whitespace by some
macro. To fix, just add some whitespace between the string literal and
the macro name.

While I could fix the errors, I’d like to know why I must do this. __TIME__ is a macro, so "something"__TIME__ would change into "something""15:52:03" (or similar) in the preprocessing stage, so the compiler would never have the opportunity to see it as operator "".

Is this behavior standards-approved or is it a bug?

  • 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-09T11:43:56+00:00Added an answer on June 9, 2026 at 11:43 am

    The issue is that "foobar"__TIME__ is no longer tokenized into the preprocessor tokens "foobar" followed by __TIME__.

    Preprocessor tokens “have the lexical form of a keyword, an identifier, a literal, an operator, or a punctuator.” The addition of user defined literals changes what is lexed as a preprocessor token. Now "foobar"__TIME__ is a single user-defined-character-literal preprocessor token, and so when phase 4 of translation occurs, which would replace __TIME__ with the "15:52:03", there is no __TIME__ token to get replaced this way.

    Yes, this behavior is specified in the standard.

    Due to the cinttypes macros it looks like more code is affected by this than the committee realized and they are considering addressing it. Some compilers are already moving to handle problems with cinttypes, however not in a way that would fix this use of __TIME__ for you. I think your best bet is to just change the code.

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

Sidebar

Related Questions

I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I am currently running into a problem where an element is coming back from
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this

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.