You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "felipecrv (via GitHub)" <gi...@apache.org> on 2024/04/10 00:42:05 UTC

[I] [C++] A macro that enables more strict assert/DCHECKS [arrow]

felipecrv opened a new issue, #41113:
URL: https://github.com/apache/arrow/issues/41113

   ### Describe the enhancement requested
   
   Often, I notice in the C++ codebase that some expected pre-conditions that shouldn't be violated, end up being violated because there are not even debug-mode assertions to prevent them from creeping in.
   
   If the violation is very serious, it's OK to add an assert and break bug-by-bug backwards compatibility, but other properties are more subtle and don't necessarily warrant a fatal check, but it would be good to be able to have them so that when running tests I could catch these violations and uncover potential bugs.
   
   This is similar to how ASAN/UBSAN/TSAN builds work: more strict checks that, if enabled in production, would crash the program due to benign failures.
   
   So what you all think of introducing a macro that can be used to wrap more strict checks?
   
   Example:
   
   ```cpp
     bool MayHaveNulls() const {
       // If an ArrayData is slightly malformed it may have kUnknownNullCount set
       // but no buffer
   #ifdef ARROW_STRICT_CHECKS
       assert((null_count.load() != kUnknownNullCount || buffers[0] != NULLPTR) &&
              "null_count == kUnknownNullCount should imply buffers[0] != NULLPTR");
   #endif
       return null_count.load() != 0 && buffers[0] != NULLPTR;
     }
   ```
   
   ### Component(s)
   
   C++


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [C++] A macro that enables more strict assert/DCHECKS [arrow]

Posted by "felipecrv (via GitHub)" <gi...@apache.org>.
felipecrv commented on issue #41113:
URL: https://github.com/apache/arrow/issues/41113#issuecomment-2096999881

   I'm closing this after discussing the idea on Zulip.
   
   https://ursalabs.zulipchat.com/#narrow/stream/180245-dev/topic/.E2.9C.94.20A.20macro.20that.20enables.20more.20.20strict.20assert.2FDCHECKS


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [C++] A macro that enables more strict assert/DCHECKS [arrow]

Posted by "felipecrv (via GitHub)" <gi...@apache.org>.
felipecrv closed issue #41113: [C++] A macro that enables more strict assert/DCHECKS
URL: https://github.com/apache/arrow/issues/41113


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org