sailfish009 sailfish009 -4 years ago 101
C++ Question

function return style logical and is okay?

func() has 3 different functions f1(), f2(), f3().

my function return BOOL, logical AND for 3 functions,

is this okay(normal)?

BOOL func(...)
{
//...
return ( f1() && f2() && f3());
}

Answer Source

Note that builtin operator && perform short-circuit evaluation; i.e. if f1() returns false then f2() and f3() won't be invoked.

If this is fine for your intent, then the code looks fine.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download