This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ 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: Something about std::list<> member functions.


On Mon, 2003-08-11 at 17:42, Jerry Quinn wrote:
> Gabriel Dos Reis writes:
>  > Jerry Quinn <jlquinn@optonline.net> writes:
>  > 
>  > | Gabriel Dos Reis writes:
>  > |  > Nathan Myers <ncm-nospam@cantrip.org> writes:
>  > |  > 
>  > |  > | On Sat, Aug 09, 2003 at 08:55:16PM +0200, Gabriel Dos Reis wrote:
>  > |  > | > Dhruv Matani <dhruvbird@gmx.net> writes:
>  > |  > | > 
>  > |  > | > [...]
>  > |  > | > 
>  > |  > | > | form At&T syntax, but I thought (and still do think) that compiler
>  > |  > | > | technology should have evolved by now so as to optimize such stuff into
>  > |  > | > | nothingness...... And, looking at g++ optimizations, I definitely
>  > |  > | > | thought that it could (at least now) optimize away the layer.
>  > |  > | > 
>  > |  > | > See recent discussions on gcc@gcc.gnu.org about inlining.
>  > |  > | 
>  > |  > | 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.
>  > 
>  > Here is what I meant:
>  > 
>  >    struct less {
>  >       template<class T>
>  >        bool operator()(const T& a, const T& b) const
>  >        { return a < b; }
>  >    };
>  > 
>  > the arguments are passed by const reference.  Is that different fro
>  > what you intend below?  If yes, please elaborate because I can't see
>  > the difference. 
> 
> Yes.  What you've written should be sufficient, but apparently there's
> a front-end deficiency that may need:
> 
> struct less {
>     template<class T>
>      bool operator()(const T& const a, const T& const b ) const
>      { return a < b; }
> };
> 
> Note the extra const's on a and b.  I don't remember the gory details
> on why this was needed, though.
> 
Is this standards compliant? What exactly does the extra const mean? The
first const obviously means that the constant reference is being passed.
Is it something like const type* const ptr? As in const pointer to type
constant? I have read the message where it is claimed to be illegal. Is
it true (as in, is it gcc specific, or what?)


> *checks inbox*
> 
> This message is what I recall about the issue:
> 
> http://gcc.gnu.org/ml/libstdc++/2003-02/msg00302.html
> 
> Jerry
-- 
	-Dhruv Matani.
http://www.geocities.com/dhruvbird/




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