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

Common Causes of Microcontroller Crashes and Solutions

Common Causes of Microcontroller Crashes and Solutions

Follow+Star Public Account Number, don’t miss exciting contentSource | Embedded Software Guest House During the development of microcontroller projects, crashes are one of the most troublesome issues. A crash can affect user experience at best, and at worst, it may lead to device damage or safety incidents. Common Causes of Crashes Classification of Causes Hardware … Read more

Exception (Interrupt) Masking Mechanism of ARM Cortex-M3/M4

Exception (Interrupt) Masking Mechanism of ARM Cortex-M3/M4

The interrupt system of Cortex-M3 is central to its implementation of real-time performance and efficient task scheduling, integrating advanced features of the ARMv7-M architecture. In certain application scenarios (such as critical sections), interrupt masking operations are often required to prevent the program from being interrupted during specific operations, similar to atomic operations. Therefore, interrupt masking … Read more

Mastering Exception Handling in Python with Ease

Mastering Exception Handling in Python with Ease

When writing Python code, errors (or exceptions) are inevitable. How to gracefully handle errors, ensuring stable program operation while facilitating debugging, is a skill that every Python developer needs to master. 1. Exception Handling in Python Exception handling is one of the important programming concepts in Python. If an exception error occurs in the code, … Read more

C++ Learning Manual – Exception Handling: Custom Exceptions

C++ Learning Manual - Exception Handling: Custom Exceptions

In the previous sections, we learned about the exception types provided by the C++ standard library (such as <span>std::runtime_error</span>, <span>std::out_of_range</span>, etc.). However, in complex projects, using standard exceptions often fails to clearly and accurately describe specific errors encountered in the program. At this point, custom exceptions become a key technology for building robust, maintainable, and … Read more

20 Essential Python Tips You Need to Know

20 Essential Python Tips You Need to Know

Source: https://medium.com The readability and simplicity of Python are two major reasons for its popularity. This article introduces 20 commonly used Python tips to enhance code readability and help you save a lot of time. The tips below will be very useful in your daily coding practice.1. Reverse a String Reverse a string using Python … Read more

Understanding Exception Handling in ARMv8

Understanding Exception Handling in ARMv8

“ A traveler asked the old monk, “What did you do before you attained enlightenment?” The old monk replied, “Chopping wood, carrying water, and cooking.” The traveler asked, “And after attaining enlightenment?” The old monk said, “Chopping wood, carrying water, and cooking.” The traveler further inquired, “What does it mean to attain enlightenment?” The old … Read more

Detailed Explanation of C++ Throw Exception

Detailed Explanation of C++ Throw Exception

In the section on C++ Exception Handling, we talked about the process of C++ exception handling, which is:Throw –> Try –> CatchExceptions must be explicitly thrown to be detected and caught; if not explicitly thrown, even if there is an exception, it cannot be detected.In C++, we use the throw keyword to explicitly throw exceptions, … Read more

ARM V8 Exception Vector Table

ARM V8 Exception Vector Table

Among them, el0_sync is the entry address for system synchronous exceptions; el0_irq is the entry address for interrupt exceptions; first, look at synchronous exceptions, where el0_svc is the exception caused by the system call svc;kernel_entry 0: indicates that this is a kernel jump from el0 to el1, performing register saving for user space, mainly saved … Read more

How ARMV8-AARCH64 Exceptions Jump to the Vector Table

How ARMV8-AARCH64 Exceptions Jump to the Vector Table

Click the blue "Arm Selected" in the upper left corner and choose "Set as Favorite" First, let’s look at a block diagram. After an interrupt occurs, the PC will jump to VBAR + interrupt offset. For example, the blue part in the diagram There are three base addresses: VBAR_EL1, VBAR_EL3, and VBAR_EL1 (secure). Which one … Read more