How well is Unicode supported in C++11?

How well does the C++ standard library support unicode? Terribly. A quick scan through the library facilities that might provide Unicode support gives me this list: Strings library Localization library Input/output library Regular expressions library I think all but the first one provide terrible support. I’ll get back to it in more detail after a … Read more

Bitwise Less than or Equal to

If x > y, then y – x or (y + (~x + 1)) will be negative, hence the high bit will be 1, otherwise it will be 0. But we want x <= y, which is the negation of this. Even better, drop the shift operator and use a bit mask on the high … Read more

LPCSTR, LPCTSTR and LPTSTR

To answer the first part of your question: LPCSTR is a pointer to a const string (LP means Long Pointer) LPCTSTR is a pointer to a const TCHAR string, (TCHAR being either a wide char or char depending on whether UNICODE is defined in your project) LPTSTR is a pointer to a (non-const) TCHAR string In practice when talking about these in the past, … Read more

QByteArray to QString

You can use QTextCodec to convert the bytearray to a string: (1015 is UTF-16, 1014 UTF-16LE, 1013 UTF-16BE, 106 UTF-8) From your example we can see that the string “test” is encoded as “t\0 e\0 s\0 t\0 \0 \0” in your encoding, i.e. every ascii character is followed by a \0-byte, or resp. every ascii character is encoded as 2 bytes. The … Read more

how to destroy an object in C++

You may not do that. delete must only be used on pointers returned from allocating non-array new. You did not get &b from an allocating new-expression. You could approach the problem from another direction: Since the number of objects doesn’t change, it could be much simpler to think of the state of the object changing, instead of destroying and creating … Read more

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