[squid-dev] RFC: Switch to C++17

Amos Jeffries squid3 at treenet.co.nz
Mon Dec 5 11:18:36 UTC 2022


I support the switch.

Caveat details below...


On 5/12/2022 5:21 am, Francesco Chemolli wrote:
> I support the switch
>
> On Sun, 4 Dec 2022 at 16:18, Alex Rousskov wrote:
>
>     Hello,
>
>     C++17 is supported by popular modern compilers and stable distros.
>     Squid
>     master branch should target those IMO. Even old environments can
>     install
>     the necessary modern compilers (e.g., RHEL5 users can get them via
>     Red
>     Hat Developer Toolset).
>
>     * GCC v5 supports most C++17 features.
>     * GCC v8 supports all relevant C++17 features.
>     * Clang v5 supports nearly all C++17 features.
>     * Clang v8 supports all relevant C++17 features.
>

non-RHEL distros shipping Squid are almost all providing at lease GCC 
v8. In many cases even their recently refreshed (Nov 2022) LTS have it.

The RHEL family distros (CentOS 7 in particular, but also many others) 
LTS versions only provide LLVM/clang v7 from the C++17 compilers.

So I think we could bump to require GCC v8 or Clang v7 minimum without 
much fuss. That would leave us figuring out what (if any) hacks we 
needed for the clang v7 vs C++17 feature gaps. Hopefully no worse than 
what we have been doing to figure out the GCC 4.8 vs C++11 feature gaps.

It has been a while since I had any info about the RedHat developer 
toolset. Do you know if GCC 8+ or LLVM/clang 8+ are in there? if so, 
then bump to v8 for both compilers and full speed ahead :-)


>
>     Switching to just C++14 would be better than nothing, but it will not
>     give us several C++17 features that we already waste serious time on
>     emulating/avoiding (e.g., std::optional). We should not switch to
>     C++20
>     yet because modern stable compilers still have some C++20 support
>     holes.
>

Agreed, C++14 is not worth the jump, and C++20 is far too early.

[ IMO in general we should leave ~5 years for the distro LTS to catch up 
on compilers releases before considering adopting a language update. ]


Cheers
Amos



More information about the squid-dev mailing list