Something about std::list<> member functions.
Jason Merrill
jason@redhat.com
Mon Aug 11 15:31:00 GMT 2003
On Mon, 11 Aug 2003 00:28:12 -0400, Jerry Quinn <jlquinn@optonline.net> wrote:
> Gabriel Dos Reis writes:
> > Nathan Myers <ncm-nospam@cantrip.org> writes:
> >
> > | Without consulting those, I recall Jason Merrill mentioning that
> > | you can get enormous optimization improvements just from declaring
> > | the inline functions' arguments "const", unnecessarily. Is that
> > | advice still current? Since it doesn't affect the ABI or standard
> > | conformance, that seems worth doing where it makes a difference.
> >
> > We already pass the arguments by const reference.
>
> If I remember right, the issue isn't passing by const ref. It's that
> early on in parsing(?) the input, when the argument itself isn't
> const, the compiler fails to see that inlining is OK. Which means you
> would have to have something like:
>
> int function(const T& x const)
>
> in order to work around the problem. Even though declaring x const is
> silly.
References are inherently const, so this is meaningless. IIRC my comment
referred to non-reference parameters. I also don't know if this is still
true.
Jason
More information about the Libstdc++
mailing list