When do you use code blocks in C/C++/C#, etc.? I know the theoretical reason behind them, but when do you use them in real programs?
EDIT: I have ju
You can get a finally like behavior in C++ by using code blocks and RAII objects.
{
std::fstream f(filename)
...
}
will release the file descriptor in the destructor no matter what causes us to leave the block.
(Personally, I'm still trying to make a practice of this. My c roots hold a death grip on my habits...)