This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [Patch] Remove workaround for copy_backward
Phil Edwards <phil@codesourcery.com> writes:
| On Sun, Sep 28, 2003 at 09:41:55AM +0200, Gabriel Dos Reis wrote:
| > Phil Edwards <phil@jaj.com> writes:
| >
| > | Is the compiler really allocating registers for arguments which it knows
| > | are unused (because they don't have formal names)?
| >
| > well, being unnamed is insufficient for the compiler to determine that
| > a particular argument won't be used.
|
| Odd. I was thinking of code like
|
| void foo (int x, int y, int z, int) { ... }
|
| There's no way for the writer of foo to access the fourth parameter, so
| why should the compiler bother to pass it at all, let alone in a register?
Because C and C++ have genuire separate compilation models :-). The
above example is the function definition, and in that context it is
clear that the last argument is not used. However, a call to foo
needs only to have its prototype available. And prototype does say
nothing about used parameters.
The case for parameters of user-defined types is different. You
cannot make a call with arguments of incomplete types. That means
that at the call site, the compiler knows which arguments whose types
are empty POD class types. So it can make the appropriate decision
(of not allocating registers for them).
-- Gaby