How to get around GCC ‘*((void*)& b +4)’ may be used uninitialized in this function warning while using boost::optional

There are two levels of uninitialized analysis in gcc: -Wuninitialized: flags variables that are certainly used uninitialized -Wmaybe-uninitialized: flags variables that are potentially used uninitialized In gcc (*), -Wall turns on both levels even though the latter has spurious warnings because the analysis is imperfect. Spurious warnings are a plague, so the simplest way to … Read more

Mixing C and C++ with CMAKE

The compiler and linker is usually determined by the file extension if not set otherwise. So as long as the file endings are fine, your code is compiled and linked with the correct compiler. On a side note, remember to make the correct extern C declarations, if you mix C and C++.

Should templated functions take lambda arguments by value or by rvalue reference?

FunctorT&& is a universal reference and can match anything, not only rvalues. It’s the preferred way to pass things in C++11 templates, unless you absolutely need copies, since it allows you to employ perfect forwarding. Access the value through std::forward<FunctorT>(f), which will make f an rvalue again if it was before, or else will leave … Read more

GCC error with variadic templates: “Sorry, unimplemented: cannot expand ‘Identifier…’ into a fixed-length argument list”

There is a trick to get this to work with gcc. The feature isn’t fully implemented yet, but you can structure the code to avoid the unimplemented sections. Manually expanding a variadic template into a parameter list won’t work. But template specialization can do that for you. template< char head, char … rest > struct … Read more

Linking to MSVC DLL from MinGW

You can’t do this. They have exported C++ classes from their dll, rather than C-functions. The difference is, c++ functions are always exported with names in a mangled form that is specific to a particular version of the compiler. Their dll is usable by msvc only in that form, and will probably not even work … Read more

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