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.
Talk about the college entrance examination
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.
Pthread multithreaded programming
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.
Memory leak caused by deleting void* pointer
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.
Memory alignment problem of structure members
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.
C language does not have a native bool type
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.
Turning the Raspberry Pi into a portable Linux compilation environment
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.
Some misunderstandings about compiler-generated default constructors
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.
Operating system interprocess communication
The methods for achieving inter-process/thread communication include:
- 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.
- Thread synchronization methods: events, critical sections, mutexes, semaphores.
C++11 syntactic sugar
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.