Welcome to MSDN Blogs Sign in | Join | Help

Tony Schreiner's WebLog

Developer - IE | Windows | Graphics. Fighting complexity for 10 years and counting.

Syndication

How ! to code

A little rant to prove I'm still alive. :-)

Here's a pattern I see every now and then that makes my brain explode. This is a simplification, but the two bools that are named exactly the same except the word "Dont" are real, as is the "partial assert" and not-completely-mutually-exclusive logic that follows. Can anybody explain why you would write code like this?

bool fDoFoo = SomeLogic();
bool fDontDoFoo = SomeOtherLogic();

assert(!(fDooFoo && fDontDoFoo));

if (fDoFoo)
{
    // Do something
}

if (!fDontDoFoo && !fDoFoo)
{
    // Do some other thing
}

Published Tuesday, October 04, 2005 7:21 PM by tonyschr

Filed under:

Comments

No Comments

New Comments to this post are disabled
Page view tracker