Three Weeks and a Button-Sized Chip: The Birth of a C Language Interpreter (Open Source)

Three Weeks and a Button-Sized Chip: The Birth of a C Language Interpreter (Open Source)

Inspired by the legendary creation of UNIX, the miracle of a C language interpreter was recreated on a button-sized chip over three special weeks.During the three special weeks from late 2024 to early 2025, drawing inspiration from the legendary creation of UNIX as an ordinary programming enthusiast, I completed a challenging task on an ESP32 … Read more

Using Go Instead of C for Embedded Linux Development? Avoid These Pitfalls!

Using Go Instead of C for Embedded Linux Development? Avoid These Pitfalls!

Go is a new generation programming language that combines the rapid prototyping advantages of Python with the performance benefits of C/C++. This characteristic makes it suitable for the embedded field as well, but what factors need to be considered to achieve optimal usage? Generally speaking, the most important evaluation aspects for correct operation include the … Read more

Bid Farewell to C++ Memory Worries: Smart Pointers, Your Trusty Memory Manager

Bid Farewell to C++ Memory Worries: Smart Pointers, Your Trusty Memory Manager

In the journey of C++, manual memory management is like walking through a minefield. Have you ever experienced this? Using <span>new</span> to allocate memory, only to silently leak it because you forgot to call <span>delete</span>; or deleting a pointer that shouldn’t have been deleted, causing fatal errors from dangling pointers; or the same memory being … Read more

The 5 Most Dangerous Operations in C++: Lessons Learned from Years of Experience

The 5 Most Dangerous Operations in C++: Lessons Learned from Years of Experience

From WeChat Official Account: Program Cat Master This article summarizes what I believe to be the five most dangerous “self-destructive” operations in C++ development, each of which can cause your program to crash or exhibit hard-to-debug strange behaviors. These pitfalls are derived from painful lessons learned, and understanding and avoiding them will greatly enhance your … Read more

Essential Guide to Advanced C Programming: Variable Arguments and Dynamic Memory Management with Principles and Examples

Essential Guide to Advanced C Programming: Variable Arguments and Dynamic Memory Management with Principles and Examples

When writing in C, do you often encounter these challenges? Want to implement a function to calculate the average of an arbitrary number of values but get stuck on “the number of parameters is uncertain”; After defining an array, you find that the memory is insufficient and have to redo the code; Even though the … Read more

Understanding the Differences Between new/delete and malloc/free in C++

Understanding the Differences Between new/delete and malloc/free in C++

In memory management for C++ and C, new/delete and malloc/free are two core sets of tools, yet they have fundamental differences. malloc/free are library functions in C that are solely responsible for memory allocation and deallocation, without involving type information, returning a void * that requires manual casting. In contrast, new/delete are operators in C++ … Read more

BDWGC: An Efficient Garbage Collector in C++

BDWGC: An Efficient Garbage Collector in C++

BDWGC: An Efficient Garbage Collector in C++ BDWGC (Boehm-Demers-Weiser conservative garbage collector) is an efficient, open-source garbage collector for C and C++ programs. It helps developers automate memory management, avoiding errors that can occur with manual memory management, such as memory leaks and dangling pointers. Project Overview BDWGC is a conservative garbage collection library that … Read more

Key Differences Between Operators in Java and C++

Key Differences Between Operators in Java and C++

A summary of the main differences between operators in Java and C++ is provided. Please add any omissions. Pointer and Reference Operators Available in C++, Not in Java: // C++ – Pointer and Reference Operators int x = 10; int* ptr = &x; // Address-of operator (&) int value = *ptr; // Dereference operator (*) … Read more

Embracing Modern C++: Moving Away from malloc/setjmp, and Adopting new/bool/Exception Handling

Embracing Modern C++: Moving Away from malloc/setjmp, and Adopting new/bool/Exception Handling

During the transition from C to C++ development, many developers unconsciously continue to use familiar C language features. However, C++ offers safer, more powerful, and expressive mechanisms to replace these traditional C methods. This article will detail how to replace <span>malloc()/free()</span>, <span>setjmp()/longjmp()</span>, and <span>int</span> type boolean flags with C++’s <span>new/delete</span>, <span>try/catch/throw</span> exception handling mechanism, and … Read more