Hi, On Thu, Jul 16, 2009 at 10:41:34PM +0300, Sergiu Ivanov wrote: > On Fri, Jul 10, 2009 at 04:17:23AM +0200, olafbuddenha...@gmx.net > wrote: > > On Sun, Jul 05, 2009 at 07:10:48PM +0300, Sergiu Ivanov wrote:
> > > I met this style (using intermediate variables) quite often in > > > unionfs and my understanding is that keeping to such style you > > > don't clobber the parameters. That is, should fsys_getroot fail, > > > port will remain unchanged. > > > > You are right. However, if it is really important that "port" > > doesn't get clobbered when an error occurs, this should be > > explicitely documented in the function comment. If callers don't > > rely on this behaviour OTOH, I wouldn't bother. > > I added the corresponding bit to the comment. IMHO, it is a good > thing when the function does not clobber its out parameters on errors. I wouldn't subscribe to it being a good thing in general. I don't see how it could avoid programming errors, or otherwise make code more readable, to always do this. It is useful only in specific cases. In this particular case it does indeed seem totally useless: it's not like the caller might have some other value in there that it would like to keep using when this call fails... This is not really an important issue, though. -antrik-