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

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

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • None
    • None
    • C++

    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

        Issue Links

          Activity

            People

              Unassigned Unassigned
              bkietz Ben Kietzman
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 3h 10m
                  3h 10m