4 ms·
C++ has try finally, which is the same thing. Instead of bloating C, anyone needing defer can use a subset of C++ that fits their needs.
by dahfizz 5y ago
C++ has try finally, which is the same thing. Instead of bloating C, anyone needing defer can use a subset of C++ that fits their needs.
- eMSF 5y agoC++ has no finally blocks.
- AnonC 5y ago> C++ has no finally blocks. Not in the standard, but there are compiler implementations (like Microsoft’s) that have added it.
- jcelerier 5y agoI just did a gh code search (__finally lang:c++), a hundred-ish instances shows up in ~12 repos mainly related to MS / .Net: sleuthkit/scalpel microsoft/service-fabric dotnet/runtime microsoft/Detours dotnet/wpf Chuyu-Team/VC-LTL apache/logging-log4net microsoft/Windows-classic-samples microsoft/winfile dotnet/llilc microsoft/DirectXShaderCompiler dotnet/diagnostics SoftEtherVPN/SoftEtherVPN microsoft/PTVS aybe/Windows-API-Code-Pack-1.1 I don't think that it's in any way meaningful, it's literally unused given that it's been there for likely 20+ years.
- kaba0 5y agoYou mix that up with RAII.
- isomel 5y agoMaybe you're mixing up with SEH (Structured Exception Handling) which is a Microsoft extension to C that came even before C++
- dgellow 5y agoSo we moved from “defer” to “using a different language, with different semantics, and use the non-standard finally”.