C++11 operator”” with double parameter

What is the problem? The problem is that the Standard forbids it. Per paragraph 13.5.8./3 of the C++11 Standard on user-defined literals: The declaration of a literal operator shall have a parameter-declaration-clause equivalent to one of the following: const char* unsigned long long int long double char wchar_t char16_t char32_t const char*, std::size_t const wchar_t*, … Read more

Why doesn’t C have binary literals?

According to Rationale for International Standard – Programming Languages C §6.4.4.1 Integer constants A proposal to add binary constants was rejected due to lack of precedent and insufficient utility. It’s not in standard C, but GCC supports it as an extension, prefixed by 0b or 0B: i = 0b101010; See here for detail.

Java string intern and literal

They have the same end result, but they are not the same (they’ll produce different bytecode; the new String(“foo”).intern() version actually goes through those steps, producing a new string object, then interning it). Two relevant quotes from String#intern: When the intern method is invoked, if the pool already contains a string equal to this String … Read more