In C++ there are multiple ways to convert from one type to another, one of those is by casting. The CppCoreGuidelines have multiple rules against casting, more in detail: ES.46: Avoid narrowing conversions ES.48: Avoid casts ES.49: If you must use a cast, use a named cast ES.50: Don’t cast away const The common suggestion is to avoid all types of casts.
Normally it is not possible to delete some system apps that came pre-installed on your Android phone. Some can be turned off so that they won’t start and show on the list of apps on your phone. Open your phone’s Settings app. Select Apps & notifications. Select the app you want to disable. Select Disable. Unfortunately, some preinstalled applications (for example Facebook on some phones, and mostly branding application of your phone or sim provider) cannot even be turned off even if they are non-essential for the phone to work.
From time to time I need to use some Windows-only program. And from time to time, those programs are also relatively old. Normally I would first try the application under WINE. If it does not work, last time I even tried the newest version of ReactOS. The last and normally infallible approach is starting a virtual machine with Windows. It always feels like an abuse of resources.
A simple use case While working on some code, I noticed a disturbing pattern: std::endl followed by std::flush. For those that do not know it, std::endl flushes the buffer, so doing std::flush does not make any sense, unless you want to pessimize your program. As the newline character normally already flushes the buffer (unless something like tie and/or sync_with_stdio has been used), it would thus make even more sense to almost always replace std::endl with '\n'.
When designing a library, or more generically an interface, we need to decide what are valid and invalid parameters. In compiled languages, it is possible to take advantage of the compiler to do some checks at compile-time, while others need to be done at runtime. For example, consider a function that generates the fibonacci sequence: int fibonacci(int); How should the code react if the input is not an integer, for example:
Tracing in C and C++ Tracing function calls is a general technique for debugging applications (and collecting information). When something does not work as expected, the first useful information is to know where the error happened, what’s the status of the program, and so on. Unfortunately, the most technique I’ve seen boil down to editing the called (or supposedly called) functions and add a printf call, hidden behind a macro that would add other information like function name and line number.