Jump to content

  • Log In with Google      Sign In   
  • Create Account


Posted 04 October 2012 - 12:43 AM

[edit: I was waaaay off on my original comment]

@Servant of the Lord: you should prefix literals with an underscore, as literal suffixes not starting with an underscore are reserved for future use. But thanks for reminding me that they exist!


Posted 03 October 2012 - 11:24 PM

Just want to point out the magic behind Servant of the Lord's post because I completely forgot about user-defined literals in C++11. I also want to add a caution that most examples of user-defined literals have an error (Servant of the Lord's example doesn't have this problem): identifiers starting with an underscore in the global namespace are reserved for the implementation. So if you come across an example that prefixes user-defined literals with an underscore (like the one I've unfortunately linked to), know that you need to either put that identifier in a namespace (out of the global namespace), or not use an underscore. Also, identifiers starting with an underscore followed by an upper case letter (or any identifier containing two consecutive underscores (in any place)) are reserved for the implementation. I just want to point this out so fewer people get in the bad habit.

Sorry for the tangent.