重载(overload)和重写(override)

In C++, overload and override are not related, but they are easily confused due to the similarity of the terms.

Read more »

Linux上的Samba配置

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 »

SublimeText的远程编译插件

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 »

关于读书的一些思考

How to delineate the most important 20% in an unfamiliar field or book? How to identify trivial details?
I hadn’t deeply contemplated these methodologies in my previous reading and studying, thinking they were merely empty talks. However, I now feel that mastering a suitable technique is like having a sharp blade in hand, allowing one to navigate obstacles with ease.

Read more »

读TC++PL、C++Primer和ISO C++

Spent a month reading TC++PL4E. Since I had previously read C++ Primer and understood most of the C++ syntax, the reading speed was quite fast. However, by reading alongside the C++ standard, I discovered many things in C++ that I previously didn’t know. From the perspective of the standard and the father of C++, C++ is indeed comprehensive enough. Thus, I’ll compare C++ Primer, TC++PL4E, and the ISO C++ documentation.

Read more »

POD is Plain Old Data. In C++, it refers to objects that can be treated as “data only,” where programmers do not need to worry about the complexity of class layout, as well as user-defined constructors, copy, and move semantics.

Read more »