You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2022/06/02 20:28:00 UTC

[jira] [Updated] (ARROW-16743) [C++] Add short-circuit version of logical Status AND

     [ https://issues.apache.org/jira/browse/ARROW-16743?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

ASF GitHub Bot updated ARROW-16743:
-----------------------------------
    Labels: pull-request-available  (was: )

> [C++] Add short-circuit version of logical Status AND
> -----------------------------------------------------
>
>                 Key: ARROW-16743
>                 URL: https://issues.apache.org/jira/browse/ARROW-16743
>             Project: Apache Arrow
>          Issue Type: Improvement
>          Components: C++
>            Reporter: Weston Pace
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> {{Status}} overloads the {{&}} operator as in (from file_base.cc):
> {noformat}
> finished_.MarkFinished(dw_status & finish_st & tg_status);
> {noformat}
> However, it also sometimes used as (from scalar.cc):
> {noformat}
> return StdHash(s.value.days) & StdHash(s.value.milliseconds);
> {noformat}
> 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 https://github.com/apache/arrow/pull/13232 because I suggested something like...
> {noformat}
> return Foo(value) & Bar(std::move(value));
> {noformat}
> 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:
> {noformat}
> return Foo(value) && Bar(std::move(value));
> {noformat}



--
This message was sent by Atlassian Jira
(v8.20.7#820007)