[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r1725957 - /subversion/trunk/subversion/svn/merge-cmd.c

From: Stefan Sperling <stsp_at_elego.de>
Date: Thu, 21 Jan 2016 18:57:41 +0100

On Thu, Jan 21, 2016 at 05:46:20PM +0000, Philip Martin wrote:
> Stefan Sperling <stsp_at_elego.de> writes:
> > Not objecting to this change, but I believe we do have a few
> > batons on the stack in several places and I don't think this
> > is a problem in general.
> It's perfectly acceptable to use a stack variable for a baton but it has
> to be in the same scope as function call. In this case moving the stack
> variable outside the if() block would have been an alternative solution.
> > The stack memory will be available until the function returns,
> > which in this case is svn_cl__merge() i.e. the main entry point
> > to the subcommand.
> >
> > The scope shouldn't matter since there's no garbage collection in C.
> The scope does matter: the C standard specifies that the lifetime of an
> object "extends from entry into the block with which it is associated
> until execution of that block ends" [6.2.4]. An optimising compiler is
> free to reuse stack slots once out of scope, either for other stack
> variables or for stack space to call a function.

Interesting. I stand corrected, thanks!
Received on 2016-01-21 18:57:51 CET

This is an archived mail posted to the Subversion Dev mailing list.