This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


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

Re: tail calls in const functions?



  In message <20000323154300.D2277@atrey.karlin.mff.cuni.cz>you write:
  > > On Thu, Mar 23, 2000 at 03:24:31PM +0100, Jan Hubicka wrote:
  > > > Hi
  > > > The tail call optimization makes function to modify the stack, that
  > > > belongs to the caller.  Is this valid for const function?
I would think so -- it's only going to diddle in the parameter area.

One way to think about a const function is does it read/write *state* that
is needed across invocations of the function or which are significant for
the behavior of other code in the program.

In this case we're modifying stack slots that will not be read again anyway;
think of those slots as pass-by-value parameters.  We can stomp on the contents
of those slots all we want since we know their value will never be used again.

jeff


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