[squid-dev] g++ 4.8.x and std::regex poblems

Christos Tsantilas christos at chtsanti.net
Wed Nov 30 09:23:39 UTC 2016

On 29/11/2016 09:46 μμ, Amos Jeffries wrote:
> I'm thinking it might be useful to add a how-to in the release notes for
> v4+ to make the compiler update easier. Would you be able to write that
> now that you have gone through the process?

I upgraded to newer OS, not just the compiler :-). It is something I 
would have to do in the next months so I decide to do it now.
However major linux distributions still does not provide stable releases 
with gcc-5.x.

> It is faster, but also has a different pattern syntax and API. So we
> would need both a config directive to specify what syntax was in use and
> a wrapper layer for portability.
> Which is exactly what std::regex provides . Though I have not gone so
> far as to add the config directive for changing the used syntax. It
> makes a lot more sense to go through the transition pain once instead of
> twice (GNURegex -> PCRE -> std::regex).

My sense is that std::regex is not a wrapper layer. It is just a 
different implementation. Maybe it is the faster implementation, OK.

We are using regex expressions in very few places and actually I believe 
that we should use RegexPattern class instead of direct calls to the 
external regex libraries. A such RegexPattern class can be small and can 
be adjusted to use many regex implementations.

It is not difficult, your patch is a prove for this, you are replaced 
old gnu regex with new std::regex with just replacing calls, without 
huge changes.

The basics regex expressions are the same. There are common flags, and 
there are flags which supported only in one library. The squid manual 
can just provide links, for example, to std::regex, pcre and gnu regex 

I know that this is a new project, I am not saying that we should 
implement support for multiple regex libraries right now, but I believe 
that it is something we should have in our mind when we are planning squid.


> Amos

More information about the squid-dev mailing list