
Gregory Dai wrote:
Well, I'm very late to this thread of discussion, but I'd like to add my $0.02.
Why would we go through so much complexity? Remember the simple and basic principle of RAII? In situations like this, you just make a simple wrapper of the FILE* ... Please read the tutorial starting from
First off, ScopeExit is recommended only if RAII doesn't fit well. For example, if you plan to call std::fclose from inside ScopeExit, you should probably replace pointers to std::FILE with fstream objects or write a wrapper for std::FILE. Lets assume you need to maintain an in memory database of Person objects: ... http://194.6.223.221/~nasonov/scope_exit-0.02/libs/scope_exit/doc/html
No need of a "try ... catch" block at all, much less of "finally," which is an unnecessary addition in C#, IMHO. ScopeExit doesn't need try-catch either.
-- Alexander Nasonov http://nasonov.blogspot.com Though I am not naturally honest, I am sometimes by chance. -- William Shakespeare -- This quote is generated by: /usr/pkg/bin/curl -L http://tinyurl.com/veusy \ | sed -e 's/^document\.write(.//' -e 's/.);$/ --/' \ -e 's/<[^>]*>//g' -e 's/^More quotes from //' \ | fmt | tee ~/.signature-quote