Why is this function call ambiguous?

It has little to do with rank of the type defined in 4.13. 4.13 defined internal rankings used to describe integral promotions and usual arithmetic conversions. They by itself do not directly affect overload resolution. Rankings relevant to overload resolution are defined in “13.3.3.1.1 Standard conversion sequences” and then used in “13.3.3.2 Ranking implicit conversion … Read more

Why are unsigned integers error prone?

One possible aspect is that unsigned integers can lead to somewhat hard-to-spot problems in loops, because the underflow leads to large numbers. I cannot count (even with an unsigned integer!) how many times I made a variant of this bug for(size_t i = foo.size(); i >= 0; –i) … Note that, by definition, i >= … Read more

Using MySQL’s TIMESTAMP vs storing timestamps directly

Arguments for TIMESTAMP It implicitly stores data in UTC time zone. No matter what your session time-zone is. Useful if you need to use different time zones. You can have automated timestamping columns using DEFAULT CURRENT_TIMESTAMP or ON UPDATE CURRENT_TIMESTAMP (one column per table only until MySQL 5.6.5) You can use datetime function for date … Read more

Cython: (Why / When) Is it preferable to use Py_ssize_t for indexing?

Py_ssize_t is signed. See PEP 353, where it says “A new type Py_ssize_t is introduced, which has the same size as the compiler’s size_t type, but is signed. It will be a typedef for ssize_t where available.” You should use Py_ssize_t for indexing. I didn’t find a definitive statement of this in the Cython docs, … Read more

Why is size_t unsigned?

size_t is unsigned for historical reasons. On an architecture with 16 bit pointers, such as the “small” model DOS programming, it would be impractical to limit strings to 32 KB. For this reason, the C standard requires (via required ranges) ptrdiff_t, the signed counterpart to size_t and the result type of pointer difference, to be … Read more

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