آهنگ های ویژه رسا موزیک

C++ Runtime Extra Quality -

One of the most misunderstood aspects of C++ is that main() is not the first code to execute.

C++ is built on top of C. Therefore, the C++ runtime includes or depends on the C runtime. On Windows, this is often the Universal C Runtime (UCRT). On Linux, it is typically glibc . c++ runtime

:

main → foo() → bar() → throw MyException(); → __cxa_throw (sets unwind info, calls _Unwind_RaiseException) → _Unwind_RaiseException → _Unwind_RaiseException_Phase1 (walks .eh_frame) → _Unwind_RaiseException_Phase2 (calls personality, destructors) → __gxx_personality_v0 (calls destructors of locals in bar, foo) → land on catch in main One of the most misunderstood aspects of C++

On Linux: readelf -S a.out (look for .init_array , .eh_frame , .gcc_except_table ) On Windows: dumpbin /HEADERS myapp.exe (look for .pdata for x64 exception tables) On Windows, this is often the Universal C Runtime (UCRT)

The __cxa_guard_acquire function uses an atomic compare‑and‑swap and a mutex or futex to ensure only one thread constructs the object.


کامنت خود را ارسال کنید

تا الان نظری ارسال نشده، شما اولین نفر باشید !