&& or ||?

moleculefile.cpp:438

if (!fileType.isEmpty() && !conv.SetOutFormat(fileType.toAscii())) {

Should it really be &&? I guess || is needed (if first condition is
true, testing of second is meaningless)


Regards,
Konstantin

On Friday 09 July 2010 16:09:27 Konstantin Tokarev wrote:

moleculefile.cpp:438

if (!fileType.isEmpty() && !conv.SetOutFormat(fileType.toAscii())) {

Should it really be &&? I guess || is needed (if first condition is
true, testing of second is meaningless)

No, I think that is correct. If fileType is not empty, and if we can set the
output format to filetype. It is C++ short circuiting, very common and useful
practice, the second command will never be executed if the first is not true.
It is often used when checking if a pointer is null,

if (object_ptr && object_ptr->doSomething()) {
// Then I successfully did something (doSomething returned true)
// act accordingly
}
else {
// failed
}

Marcus