Status overloads the & operator as in (from file_base.cc):
finished_.MarkFinished(dw_status & finish_st & tg_status);
However, it also sometimes used as (from scalar.cc):
return StdHash(s.value.days) & StdHash(s.value.milliseconds);
This latter form is technically correct (in this case) because StdHash has no side effects and there is no real need to short-circuit. However, this can be very misleading. The compiler is allowed to reorder these statements as it wants. This led to trouble in #13232 because I suggested something like...
return Foo(value) & Bar(std::move(value));
Now, for a C++ expert, this may have been immediately obvious. However, I think we can simplify things by adding the && operator for Status to allow:
return Foo(value) && Bar(std::move(value));
Reporter: Weston Pace / @westonpace
PRs and other links:
Note: This issue was originally created as ARROW-16743. Please see the migration documentation for further details.
Statusoverloads the&operator as in (from file_base.cc):However, it also sometimes used as (from scalar.cc):
This latter form is technically correct (in this case) because
StdHashhas no side effects and there is no real need to short-circuit. However, this can be very misleading. The compiler is allowed to reorder these statements as it wants. This led to trouble in #13232 because I suggested something like...Now, for a C++ expert, this may have been immediately obvious. However, I think we can simplify things by adding the
&&operator forStatusto allow:Reporter: Weston Pace / @westonpace
PRs and other links:
Note: This issue was originally created as ARROW-16743. Please see the migration documentation for further details.