This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: Idea for more delegations in <algorithm>
- From: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- To: Paolo Carlini <pcarlini at suse dot de>
- Cc: Chris Jefferson <caj at cs dot york dot ac dot uk>, libstdc++ <libstdc++ at gcc dot gnu dot org>
- Date: 23 Mar 2005 18:35:39 +0100
- Subject: Re: Idea for more delegations in <algorithm>
- Organization: Integrable Solutions
- References: <4241980D.7010908@suse.de> <4241A3CC.8040208@cs.york.ac.uk><4241A625.3060907@suse.de>
Paolo Carlini <pcarlini@suse.de> writes:
| Chris Jefferson wrote:
|
| > | Or, for some reason, we have troubles with this too? :(
| >
| > Unless I'm going mad (possible), default parameters are inserted and
| > passed by the compiler (at least on x86), so this will in fact be worse,
| > because that "0" will always be created and passed by the compiler
| > (because it might be needed for all it knows) whereas the empty classes
| > might eventually be optimised away with compiler improvements.
|
| I see, I was afraid that something like that could happen, in
| principle (have never looked myself to the actual way defaults are
| compiled)
There is always a value passed to the function -- when none is
lexically specified in the source code, the compiler uses the default
value.
The situation is slightly different for empty classes: we and the
compiler know that a value of that type is insignificant. So, it
could be safely not loaded into the argument list.
For the enable-if stuff, only we (and not the compiler) know that the
default is just a hackery artefact -- except when the function is of
course inline and inlined.
-- Gaby