RTTI – dynamic_cast
Run-time type information (RTTI) enables determining object type during runtime. This is enabled by the following language features: This post only talks about dynamic_cast. dynamic_cast “The need for dynamic_cast generally arises because you want to perform derived class operation on a derived class object, but you have only a pointer or reference-to-base” said Scott Meyers in his […]
Linux x64 NASM Base64Encoder
In this post I present the small efficient Base64Encoder I’ve written in NASM assembler for Linux x64. This comes from a project I’ve done recently. Build instructions: nasm -f elf64 base64encode.asmld base64encode.o -o base64encode The encoder reads the data from standard input stream. For example: echo ‘Hello World!’ | ./base64encode or one can base encode […]
C++ – How to Parse Command Line Arguments
In this tip I want to show a quick way (one of many) for parsing command line arguments using C++17. A quick way of parsing command line arguments in modern C++-17 for non-production without using third party header files / libraries. For real world projects, a third party approach is more encouraged. Background Very often, […]
C++ Character Encoding Explained
(Edited on 20.09.2020) In this post I’ll try to clarify some dark corners of character encoding process in C++, going out from the source file, over compilation to the final output. After many years dealing with C++ I still have an impression that this topic is making difficulties, especially to the new C++ programmers (at […]
Installing Android x86 on VirtualBox
In this post I will show how to install the Android OS on VirtualBox. I’m normally using this during my Android Development to cut up my development time. I find deployment to the VirtualBox machine to be faster than deploying to the Emulated Android Devices, which come with Android SDK. I’m using the emulated android […]
Memory Alignment & Padding
What is meant with “memory alignment” ? The CPU (memory controller) access the memory by a single word in time. The next examples are the simplified illustration of the background problem: Say for example that the data fits and is aligned within the single word, like in the following image: In this case the data […]
CMake – Make it Simple – Part I
About CMake Visual Studio Project without CMake Makefile project without CMake Using CMake About CMake This is the first part of the cmake tutorial. It is aimed to the absolute beginners and tries to explain the cmake principle in simple terms. I assume that you already now how to write programs. I also assume that […]
C++ Lambda’s – simply explained
The C++-11 brought lambda expressions, which are a convient way of defining clojures. Before C++-11 a typical way to pass function-like objects to algorithms was to define a class/struct with operator()(…). For example for sorting vector of pairs of 2 integers by the value of the second element would in C++98 look something like: Since […]