In C and C++, there are many versions of the main function prototype that circulate, and different books present different ways of writing it. Today, I will explore what constitutes “standard behavior” from the perspectives of several standards (C89/99/11 and C++98/03/11/14) and what happens after the main function returns.

Read more »

Previously, it has been mentioned several times that C and C++ are not the same language. Even the part inherited from C in C++ has significant differences from ISO C. I will gradually compile some of their incompatible features here.

Read more »

Many C++ books do not clearly state the difference between declaration and definition, or they only mention the need to support separate compilation, indicating that using the extern specifier is a declaration, while without it is a definition. In fact, I think the C++ standard describes the difference between declaration and definition more clearly.

Read more »

Through a CppQuiz question to describe the order of construction and destruction of C++ objects in the context of inheritance according to the C++14 standard, as well as throwing exceptions during object construction/destruction.

Read more »

Through Samba, we can mount folders from Linux to Windows. After deploying Samba on a Linux virtual machine, I can use the remote compilation plugin I wrote a few days ago (sublimeRemoteCompile) to write code on Windows! It’s quite enjoyable. Today, I will briefly record how to configure Samba sharing on the server for friends with similar needs.

Read more »

Running some small test codes on Linux from Windows can be quite tedious, especially since I have to manually execute the compilation commands on Linux. Also, using Samba on my Raspberry Pi to share the code to Windows requires me to SSH and compile it manually, which is a waste of time.
These past few days, I wrote a small Sublime Text plugin during my free time to remotely compile C/C++ code on Windows, meaning that I write the code on Windows but it actually executes on Linux. I’ve only implemented the functionality for now, and I plan to optimize it during my break after the holidays.
The code is hosted on GitHub: sublimeRemoteCompile, using some C++11 features, and the compiler must be specified during compilation.

Read more »

For arrays, subscript operations are a way of random reading and writing, and they are also the most common method. However, many textbooks (especially domestic ones) state that the array name is a pointer, which is incorrect. Moreover, there are a set of rules behind array subscript access; familiarizing yourself with these rules can help analyze the actual meaning of the code in some complex semantic situations.

Read more »

Using variable-length parameter templates and lambda (or using generic lambda) to wrap overloaded member function pointers for convenient usage (like bind binding or other places that require overloaded member function pointers). For more introduction on member function pointers, please see my other article: Pointers to Class Members in C++ Are Not Pointers.

Read more »