This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] regex_traits implementation


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]