[
https://issues.apache.org/jira/browse/THRIFT-5462?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jens Geyer updated THRIFT-5462:
-------------------------------
Summary: Expose preprocessor macros to inspect the Thrift library version
(was: [C++] Expose preprocessor macros to inspect the Thrift library version)
> Expose preprocessor macros to inspect the Thrift library version
> ----------------------------------------------------------------
>
> Key: THRIFT-5462
> URL: https://issues.apache.org/jira/browse/THRIFT-5462
> Project: Thrift
> Issue Type: Wish
> Components: C++ - Library
> Affects Versions: 0.14.2
> Reporter: Antoine Pitrou
> Priority: Minor
>
> In Parquet C++, we would like to make use of the new {{TConfiguration}}
> introduced in 0.14.0. However, we also want our source code to be compatible
> with previous versions. It would be made greatly easier if we could do that
> using preprocessor directives, such as:
> {code:c++}
> uint8_t* buf = ...;
> unt32_t len = ...;
> std::shared_ptr<ThriftBuffer> mem_transport;
> #if THRIFT_VERSION_MAJOR > 0 || THRIFT_VERSION_MINOR >= 14
> auto config = std::make_shared<TConfiguration>();
> config->setMaxMessageSize(...);
> mem_transport = std::make_shared<TMemoryBuffer>(
> buf, len, TMemoryBuffer::OBSERVE, config);
> #else
> mem_transport = std::make_shared<TMemoryBuffer>(buf, len);
> #endif
> {code}
> However, given that the C++ library doesn't seem to expose such constants,
> we're going to need to run custom tests during the configuration step to find
> out whether TConfiguration is available...
--
This message was sent by Atlassian Jira
(v8.3.4#803005)