[patch] regex_traits implementation

Jonathan Wakely jwakely.gcc@gmail.com
Tue Jul 2 20:42:00 GMT 2013


On 2 July 2013 20:27, Paolo Carlini wrote:
>
>
> Hi,
>
>>Second, making it `const` enables more potential compiler
>>optimizations.
>
> Stylistically, we already discussed this in the past and the outcome was that normally we don't use const by value anywhere. But personally I don't have a strong opinion and certainly I would not object if it makes a difference from the optimization point of view: as far as I know it does *not*, like it does not declaring const a local, do you have some up to date evidence that it does?

It doesn't make any difference. The compiler knows that the object
isn't modified and is a function parameter so cannot be aliased, so
making it const makes no difference at all.



More information about the Libstdc++ mailing list