slight correction for exception safety?

Karen Lanrap karen at digitaldaemon.com
Sun Oct 15 11:17:12 PDT 2006


>From the article:

class Foo
{
    bool verbose;	// true means print messages, false means 
silence
    ...
    bar()
    {
	auto verbose_save = verbose;
	verbose = false;
	scope(exit) verbose = verbose_save;

	...lots of code...
    }
}

The scope statement should be moved before the assignment.

By the way: what will happen if a scope statement is used as an 
argument for a lazy parameter of a function?



More information about the Digitalmars-d mailing list