[
https://issues.apache.org/jira/browse/AVRO-3705?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17686423#comment-17686423
]
ASF subversion and git services commented on AVRO-3705:
-------------------------------------------------------
Commit c92b2bf2927cd0d1a5c32fc781beee353888c3ff in avro's branch
refs/heads/avro-3631/fix-fixed-serialization from Andrew Peter Marlow
[ https://gitbox.apache.org/repos/asf?p=avro.git;h=c92b2bf29 ]
Avro 3705 cpp17 option (#2055)
* Writer code generated warning after copyright message. Change throw for
invalid type for union to give structName in the exception text.
* AVRO-3705 Added --cpp17 command line option to force std::any in emitted code
> avrogencpp needs an option to generate code using std instead of boost
> ----------------------------------------------------------------------
>
> Key: AVRO-3705
> URL: https://issues.apache.org/jira/browse/AVRO-3705
> Project: Apache Avro
> Issue Type: Improvement
> Components: c++
> Affects Versions: 1.11.0
> Environment: RHEL8. The gcc installed from the Red Hat repo is
> version 8.5.0 which has an option to use c++17 since that dialect is not the
> default. The avro-cpp package in the Red Hat repo must have been built with
> that since it emits code that uses boost.
> Reporter: Andrew Peter Marlow
> Assignee: Andrew Peter Marlow
> Priority: Minor
> Labels: pull-request-available
> Fix For: 1.12.0, 1.11.2
>
> Time Spent: 10m
> Remaining Estimate: 0h
>
> avrogencpp uses either std or boost in the generated code. It does this
> depending on how it was built, using #if __cplusplus >= 201703L. If the
> compiler supports std::any then it used, otherwise boost is used.
> The assumption is that if the compiler used to build avrogencpp supports
> C\+\+17 by default then emitted code can use C\+\+17 otherwise the emitted
> code should use boost. This assumption turns out to have a weakness - if a
> project uses a compiler where C+17 is given as an option because it is not
> the default then the code avrogencpp generates will use boost instead of std.
> This problem could be solved if avrogencpp supported a command line option to
> use c\+\+17. The option could be used by those environments where avrogencpp
> was built with a version of gcc that does not support c17 by default but the
> desire is to use C+17.
> This is a serious need because there is a significant difference between
> boost::any and std::any. The standard any has a small buffer optimisation but
> boost does not. This means that code generated by avrogencpp that uses
> boost::any will use heap memory for every case where the generated code uses
> the any type. This could be avoided if the c++17 option was available.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)