RAII - cppreference.com
6
公开标注数
6
参与人数
2026-07-28 09:47:42
首次 Whisper
本页的公开 Whisper
划选高亮2026-07-28 16:11:42
原文高亮摘录
“Move semantics enable the transfer of resources and ownership between objects”
Whisper 随想笔记
This is exactly why modern C++ feels so much safer than the old pointer juggling days.
划选高亮2026-07-28 13:08:42
原文高亮摘录
“the destructor releases the resource and never throws exceptions”
Whisper 随想笔记
Makes sense, but what if cleanup itself can fail? Then you're stuck.
划选高亮2026-07-28 12:59:42
原文高亮摘录
“the destructor releases the resource and never throws exceptions”
Whisper 随想笔记
If it throws in a destructor, you're basically asking for std::terminate.
划选高亮2026-07-28 10:05:42
原文高亮摘录
“binds the life cycle of a resource that must be acquired before use”
Whisper 随想笔记
Doesn't that just mean 'don't forget to free stuff' with extra steps?
划选高亮2026-07-28 09:56:42
原文高亮摘录
“binds the life cycle of a resource that must be acquired before use”
Whisper 随想笔记
I've been doing this in C++ for years without even knowing the fancy name.
划选高亮2026-07-28 09:47:42
原文高亮摘录
“binds the life cycle of a resource that must be acquired before use”
Whisper 随想笔记
Wait, so it's basically the object's destructor doing the cleanup, right?
分享本页 Whisper
短链接
https://domwhisper.com/s/6a4c7da5711c嵌入代码
<iframe src="https://domwhisper.com/embed/6a4c7da5711c" width="100%" height="480" style="border:0;border-radius:16px" loading="lazy"></iframe>