You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@avro.apache.org by "Martin Tzvetanov Grigorov (Jira)" <ji...@apache.org> on 2023/01/31 11:03:00 UTC

[jira] [Resolved] (AVRO-3705) avrogencpp needs an option to generate code using std instead of boost

     [ https://issues.apache.org/jira/browse/AVRO-3705?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Tzvetanov Grigorov resolved AVRO-3705.
---------------------------------------------
    Fix Version/s: 1.12.0
                   1.11.2
         Assignee: Andrew Peter Marlow
       Resolution: Fixed

> 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
>             Fix For: 1.12.0, 1.11.2
>
>
> 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)