How to override a virtual member function which has the same name in two base classes

This problem doesn’t come up very often. The solution I’m familiar with was designed by Doug McIlroy and appears in Bjarne Stroustrup’s books (presented in both Design & Evolution of C++ section 12.8 and The C++ Programming Language section 25.6). According to the discussion in Design & Evolution, there was a proposal to handle this … Read more

C++ project type: unicode vs multi-byte; pros and cons

Two issues I’d comment on. First, you don’t mention what platform you’re targeting. Although recent Windows versions (Win2000, WinXP, Vista and Win7) support both Multibyte and Unicode versions of system calls using strings, the Unicode versions are faster (the multibyte versions are wrappers that convert to Unicode, call the Unicode version, then convert any returned … Read more

How to tell Clang to stop pretending to be other compilers?

__GNUC__ doesn’t mean GCC specifically. All compilers that support GNU C extensions define it, including clang and ICC. The normal way to detect specifically GCC is by excluding other “compatible” compilers #if defined(__GNUC__) && !defined(__llvm__) && !defined(__INTEL_COMPILER) #define REAL_GCC __GNUC__ // probably #endif The Clang front-end defines __clang__, but other front-ends that use the LLVM … Read more

64bit Applications and Inline Assembly

Visual C++ does not support inline assembly for x64 (or ARM) processors, because generally using inline assembly is a bad idea. Usually compilers produce better assembly than humans. Even if you can produce better assembly than the compiler, using inline assembly generally defeats code optimizers of any type. Sure, your bit of hand optimized code … Read more

Dollar sign in variable name

The only legal characters according to the standard are alphanumerics and the underscore. The standard does require that just about anything Unicode considers alphabetic is acceptable (but only as single code-point characters). In practice, implementations offer extensions (i.e. some do accept a $) and restrictions (most don’t accept all of the required Unicode characters). If … Read more

Possible to stop generating *.ipdb *.iobj files by VIsual Studio 2015?

These files are produced when Incremental Link-Time Code Generation (LTCG) is enabled. This is a new feature in Visual C++ 2015. If you disable Incremental LTCG, the linker will stop producing these files. But then you lose the benefits of Incremental LTCG. To disable Incremental LTCG, modify your project properties: Under Linker => Optimization change … Read more

Win32: Bring a window to top

try this,it is said coming from M$ HWND hCurWnd = ::GetForegroundWindow(); DWORD dwMyID = ::GetCurrentThreadId(); DWORD dwCurID = ::GetWindowThreadProcessId(hCurWnd, NULL); ::AttachThreadInput(dwCurID, dwMyID, TRUE); ::SetWindowPos(m_hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE); ::SetWindowPos(m_hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE); ::SetForegroundWindow(m_hWnd); ::SetFocus(m_hWnd); ::SetActiveWindow(m_hWnd); ::AttachThreadInput(dwCurID, dwMyID, FALSE); In order to bring a window … Read more

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