raii

sybrandy sybrandy at gmail.com
Sun Feb 28 12:34:59 PST 2010


<snip>

I have two questions for you:

1) Are class destructors not good enough?  If so, why?

2) Have you looked into static destructors?  I created a logging library 
and that worked perfect for me to ensure that if I killed the program 
via Ctrl-C, it would flush the output buffer and close the file handle.

Personally, I really like the use of "scope" vs. RAII.  Keeping the code 
to clean up a file handle or the like right by where it's declared seems 
very sensible to me.

Casey


More information about the Digitalmars-d-learn mailing list