orc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Owen O'Malley" <owen.omal...@gmail.com>
Subject Re: Usage of ORC_UNIQUE_PTR
Date Wed, 31 Oct 2018 18:07:41 GMT
Ok, we should have done a better job at documenting these.

For most of the features like ORC_UNIQUE_PTR and ORC_NOEXCEPT, we take two
different approaches depending on the context:

In external header files, we always use the ORC_*, because the users have
to be able to include our header files into their projects without getting
dangerous #defines.

In our internal code, we have #defines in c++/src/Adaptor.hh.in that map
the "normal" form into the ORC_* form. So if the C++ compiler doesn't have
"noexcept" we have a define that looks like #define noexcept ORC_NOEXCEPT.
Thus, in our internal code we can just write "noexcept" and the compilers
that have it, will use it. The compilers that don't will have the token
dropped.

Now, ORC_UNIQUE_PTR is also a historic case, where we needed it for CentOS
5 (and probably some of the other older OS), before we dropped support for
it. Looking through the logs from my runs from ORC-418, we don't need
ORC_CXX_HAS_UNIQUE_PTR on linux:

centos6-test.log:-- Performing Test ORC_CXX_HAS_UNIQUE_PTR - Success
> centos7-test.log:-- Performing Test ORC_CXX_HAS_UNIQUE_PTR - Success
> debian8-test.log:-- Performing Test ORC_CXX_HAS_UNIQUE_PTR - Success
> debian9-test.log:-- Performing Test ORC_CXX_HAS_UNIQUE_PTR - Success
> ubuntu12-test.log:-- Performing Test ORC_CXX_HAS_UNIQUE_PTR - Success
> ubuntu14-test.log:-- Performing Test ORC_CXX_HAS_UNIQUE_PTR - Success
> ubuntu16-test.log:-- Performing Test ORC_CXX_HAS_UNIQUE_PTR - Success
> ubuntu18-test.log:-- Performing Test ORC_CXX_HAS_UNIQUE_PTR - Success
>

We also don't need it on MacOS. I don't know if we need it for Windows.

.. Owen


On Tue, Oct 30, 2018 at 7:15 PM Gang Wu <gangwu@apache.org> wrote:

> Hi Fang,
>
> ORC_UNIQUE_PTR was intended to support platforms which does not support
> c++11. You can also find that std::unique_ptr is translated into
> std::auto_ptr as well. Current and future versions of ORC will not support
> those obsolete platforms; therefore I think it is ok to use std::unique_ptr
> everywhere.
>
> Best,
> Gang
>
> On Tue, Oct 30, 2018 at 5:31 PM Fang Zheng <zhengfang.xjtu@gmail.com>
> wrote:
>
> > Hi,
> >
> > I have a question about the usage of ORC_UNIQUE_PTR in C++ code:
> >
> >
> > The ORC_UNIQUE_PTR macro is used intensively in the public header files
> in
> > c++/include/. On the other hand, among those files in c++/src/ directory,
> > std::unique_ptr appears much more frequently than ORC_UNIQUE_PTR (356 vs.
> > 16 by grep). In fact, some function declarations in header files use
> > ORC_UNIQUE_PTR while the definitions in src use std::unique_ptr (please
> see
> > JIRA ORC-428 and the pull request:
> https://github.com/apache/orc/pull/331
> > ).
> >
> >
> > Assuming that ORC_UNIQUE_PTR is intended to work regardless of whether
> > std::unique_ptr is available, I am wondering if ORC_UNIQUE_PTR should be
> > preferred in the entire c++ codebase.
> >
> >
> > Thanks,
> >
> > Fang
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message