Uploaded image for project: 'Apache Arrow'
  1. Apache Arrow
  2. ARROW-6781

[C++] Improve and consolidate ARROW_CHECK, DCHECK macros

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: C++
    • Labels:
      None

      Description

      Currently we have multiple macros like DCHECK_EQ and DCHECK_LT which check various comparisons but don't report anything about their operands. Furthermore, the "stream to assertion" pattern for appending extra info has proven fragile. I propose a new unified macro which can capture operands of comparisons and report them:

        int three = 3;
        int five = 5;
        DCHECK(three == five, "extra: ", 1, 2, five);
      

      Results in check failure messages like:

      F1003 11:12:46.174767  4166 logging_test.cc:141]  Check failed: three == five
        LHS: 3
        RHS: 5
      extra: 125
      

        Attachments

          Activity

            People

            • Assignee:
              bkietz Ben Kietzman
              Reporter:
              bkietz Ben Kietzman
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: