On May 14, 2006, at 2:40 PM, Sven de Marothy wrote:

On Sun, 2006-05-14 at 12:45 -0700, Casey Marshall wrote:

Yeah, I figured out what you were doing when going to sleep last
night ;-)

But still, wouldn't an && be better for that?

if( callA() == 0 && callB() == 0 )
 result = value1;
else
 result = value2;

Versus:

result = ((callA() | callB()) == 0) ? value1 : value2;

See? Shorter code! ;)


Hmm?

  result = (!callA() && !callB()) ? value1 : value2;

The && should also short-circuit the call to callB() if callA() fails, which is probably what you want.

But this is getting really nit-picky, and I don't care that much :-)

Attachment: PGP.sig
Description: This is a digitally signed message part

Reply via email to