Let’s look at this C++ program: When you build it in Debug and in Release mode, then: Same code. Same compiler. Different result. What does it mean? The bug comes from the undefined behavior of the uninitialized variable x: x is declared, but never initialized and immediately used: At this…
undefined behavior
Calling member function on a nullptr in C++
Welcome to the next pikoTutorial! nullptr and the segmentation fault One of the first things that beginner C++ programmers realize after starting to play around with pointers is that dereferencing a nullptr leads to an immediate program crash caused by the segmentation fault. This leads to a common belief that…