Whatever happened to the ‘entry’ keyword?

I had no idea, so I googled to find something about this. This is what I found. First, it was included as a reserved keyword. Q: What was the entry keyword mentioned in K&R1? A: It was reserved to allow functions with multiple, differently-named entry points, but it has been withdrawn. (From http://archives.devshed.com/forums/c-c-134/c-programming-faqs-371017.html.) It was … Read more

Why is C++20’s `std::popcount` restricted to unsigned types?

Pretty simple: Implicit widening conversions on unsigned types do not change the result. Implicit widening conversions on signed types (including promotions) perform sign-extension, which does change the result if the input was negative. Having an operation whose result becomes incorrect due to integer promotion definitely falls into the “foot cannon” category. You can still feed … Read more

Why does C++ mandate that complex only be instantiated for float, double, or long double?

You can’t properly implement many of the std::complex operations on integers. E.g., template <class T> T abs(const complex<T> &z); for a complex<long> cannot have T = long return value when complex numbers are represented as (real,imag) pairs, since it returns the value of sqrt(pow(z.real(), 2) + pow(z.imag(), 2)). Only a few of the operations would … Read more

does a disaster proof language exist?

Erlang was designed for use in Telecommunication systems, where high-rel is fundamental. I think they have standard methodology for building sets of communicating processes in which failures can be gracefully handled. ERLANG is a concurrent functional language, well suited for distributed, highly concurrent and fault-tolerant software. An important part of Erlang is its support for … Read more

Why are most string manipulations in Java based on regexp?

Note that the regex need not be recompiled each time. From the Javadoc: An invocation of this method of the form str.split(regex, n) yields the same result as the expression Pattern.compile(regex).split(str, n) That is, if you are worried about performance, you may precompile the pattern and then reuse it: Pattern p = Pattern.compile(regex); … String[] … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)