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: [Patch] Remove workaround for copy_backward


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?
Of course the actual fourth argument still has to be evaluated for side
effects and such, e.g., foo(1,2,3,++bar), but the assembky code to set up,
call, and return from foo shouldn't need to worry about loading the result.

Unless of course there's some weird rule I'm forgetting.


Phil

-- 
Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it.
    - Brian W. Kernighan


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