2016:未来计划


It’s hard to believe that I will soon graduate from university. Although I have learned (and struggled with) quite a lot during my time at university, I still feel that I need to improve and keep working hard.
I have a few thoughts about the future, and I will write them down at this moment to motivate myself.

Read more »

谈高考

These days are the time for the college entrance examination, and it reminds me of a few years ago when I took the exam. Back then, I was still too young, thinking that if I had something I wanted to pursue, I should go for it, wasting a lot of time learning programming. But looking back now, it’s important to study hard in high school, as a degree is indeed a threshold for just graduating.

Read more »

Pthread多线程编程

POSIX Threads (English: POSIX Threads, commonly abbreviated as Pthreads) is the POSIX thread standard that defines a set of APIs for creating and manipulating threads.

Read more »

删除void*指针引发的内存泄露

When a void* points to a class object, performing a delete operation on it will lead to undefined behavior—it is certain that this delete operation will not call the object’s destructor, resulting in a memory leak.

Read more »

结构体成员内存对齐问题

Before discussing memory alignment, let’s first introduce a related concept—offset.

The distance between the actual address of a storage unit and the segment address where it is located is called the intra-segment offset, also known as the “effective address or offset.”

In simple terms, in a structure, the offset refers to the difference between the address of a member in a structure variable and the address of the structure.

Read more »

C语言中不具有原生bool类型

It seems a bit clickbaity; to be precise, there is no bool keyword in the C language standard to represent boolean types. In C++, we usually use bool variables to store logical values. However, there is no bool type in C; C only has the _Bool type. Today, when discussing this issue with someone, it can indeed be confusing, so I’m writing it down for future reference.

Read more »

将树莓派打造成便携的Linux编译环境

I have a Raspberry Pi 2B+ that has been collecting dust for quite a while. Due to frequent power outages at school, I haven’t used it for running scripts or downloads. However, recently, the SSH connection to the VPS has been dropping due to power/network issues, which has been quite frustrating. So I’ve decided to turn the Raspberry Pi into a portable compiling environment.

Read more »

关于编译器生成默认构造函数的一些误区

When a class we write does not explicitly provide a constructor but the compiler needs a constructor (be sure to note this phrase), the compiler will generate one for us. However, the default constructor generated by the compiler does not meet our expectations of what it can accomplish.

Read more »

进程间通信

The methods for achieving inter-process/thread communication include:

  1. Inter-process communication methods: file mapping, shared memory, anonymous pipes, named pipes, message slots, clipboard, dynamic data exchange, object linking and embedding, dynamic link libraries, remote procedure calls, etc.
  2. Thread synchronization methods: events, critical sections, mutexes, semaphores.
Read more »

C++11的语法糖

From C language to C++03, the OO features feel absolutely great. Recently, I focused on the new features of C++11 and found many fantastic syntactic sugars! It’s also very enjoyable to use.

Read more »