raii
Idiomatic short lifespan local objects akin to RAII
I came across this fragment of Objective-C: NSNumber *theBalance = [[[NSNumberFormatter alloc] init] numberFromString: [textField text]];[详细]
2023-04-12 14:21 分类:问答RAII-Wrapper for .NET?
Is it theoretically possible to create a RAII-Wrapper for .NET? As a long time C++ programmer I hate to manage object lifetime myself agai开发者_开发知识库n. The Dispose-Pattern is IMHO nothing but a[详细]
2023-04-12 08:55 分类:问答C++ RAII Questions
So as I understand it to implement RAII properly, if I where to call CreateFont, I\'d wrap that in a cl开发者_JAVA技巧ass with CreateFont in the constructor and DeleteObject in the destructor, so it c[详细]
2023-04-08 23:51 分类:问答Why is gcc destroying my object instantly despite its scope? (and how do I make it not do that?)
I wrote a small profiling class with an accompanying guard class to use like this: { ProfileGuard pg(\"SampleName\");[详细]
2023-04-06 08:57 分类:问答Formal treatment of RAII and/or safe deallocations in C++
Are there any research papers on formal treatment of RAII and/or 开发者_运维百科safe deallocations in C++?Take a look at \"A Mechanized Semantics for C++ Object Construction and[详细]
2023-04-04 16:46 分类:问答Why the Destructor in C++ de-allocated memory in reverse order of how they were initialised?
What is the advantage in de-allocating memory i开发者_JAVA技巧n reverse order to variables?Consider this example:[详细]
2023-04-01 05:44 分类:问答Is there a common pattern to give objects Expression or State lifetimes in c# with automated state-leaving actions?
There are four basic lifetimes of objects in imperative applications: Expression (temporary) lifetime Scope lifetime[详细]
2023-03-31 09:11 分类:问答How to handle object destruction in error case vs. non-error case
I have a program that is responsible for reading data, formatting it and creating records, and outputting records to files. The important classes for this discussion are:[详细]
2023-03-30 15:22 分类:问答How to manage COM objects runtime in RAII style in C# programs?
My C# program uses a COM component that has a ton of various interfaces and subobjects. The problem is each time I retrieve some COM interface an RCW is created and that RCW exists for unknown time (u[详细]
2023-03-26 22:37 分类:问答When can garbage collection be faster than manual memory management? [closed]
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references,or expertise, but this question will likely solicit debate, a[详细]
2023-03-26 19:08 分类:问答