You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ap...@apache.org on 2020/05/07 09:52:17 UTC

[arrow] branch master updated: ARROW-8720: [C++] Fix checked_pointer_cast ifdef logic

This is an automated email from the ASF dual-hosted git repository.

apitrou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new d127e6a  ARROW-8720: [C++] Fix checked_pointer_cast ifdef logic
d127e6a is described below

commit d127e6ab55ee3f17ea8ddb4b1fbfb81a26b7b378
Author: François Saint-Jacques <fs...@gmail.com>
AuthorDate: Thu May 7 11:51:49 2020 +0200

    ARROW-8720: [C++] Fix checked_pointer_cast ifdef logic
    
    The expensive version (dynamic_pointer_cast) was enabled in release build instead of debug builds. This aligns with `checked_cast`.
    
    Closes #7117 from fsaintjacques/ARROW-8720
    
    Authored-by: François Saint-Jacques <fs...@gmail.com>
    Signed-off-by: Antoine Pitrou <an...@python.org>
---
 cpp/src/arrow/util/checked_cast.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/cpp/src/arrow/util/checked_cast.h b/cpp/src/arrow/util/checked_cast.h
index 149e9d6..3692bd9 100644
--- a/cpp/src/arrow/util/checked_cast.h
+++ b/cpp/src/arrow/util/checked_cast.h
@@ -40,7 +40,7 @@ inline OutputType checked_cast(InputType&& value) {
 
 template <class T, class U>
 std::shared_ptr<T> checked_pointer_cast(const std::shared_ptr<U>& r) noexcept {
-#ifndef NDEBUG
+#ifdef NDEBUG
   return std::static_pointer_cast<T>(r);
 #else
   return std::dynamic_pointer_cast<T>(r);
@@ -49,7 +49,7 @@ std::shared_ptr<T> checked_pointer_cast(const std::shared_ptr<U>& r) noexcept {
 
 template <class T, class U>
 std::unique_ptr<T> checked_pointer_cast(std::unique_ptr<U> r) noexcept {
-#ifndef NDEBUG
+#ifdef NDEBUG
   return std::unique_ptr<T>(static_cast<T*>(r.release()));
 #else
   return std::unique_ptr<T>(dynamic_cast<T*>(r.release()));