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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]