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

Re: svn commit: rev 7365 - in trunk/subversion: include libsvn_subr libsvn_wc

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: 2003-10-09 19:17:59 CEST

kfogel@collab.net wrote:
> "C. Michael Pilato" <cmpilato@collab.net> writes:
>
>>kfogel@collab.net writes:
>>
>>>julianfoad@tigris.org writes:
>>>
>>>>Log:
>>>>Remove "const" where it was over-zealously used on some function parameters
>>>>that are passed by value. It has no meaning in the interface, and only
>>>>exposes an artifact of the current implementation.
>>>
>>>Doesn't 'const' prevent the callee from changing the value of the
>>>argument locally?
>>
>>Who cares? If you change the value of a variable passed by value, it
>>doesn't affect the caller at all.
>
> Veering dangerously close to a generic C usage discussion, but... :-)
>
> You might care if you want to alert the programmer that a) the
> variable signifies some important piece of data from the calrer, and
> b) the callee's logic counts on that data remaining consistent
> throughout its code.
>
> In other words, you'd use it for the same reason you use 'const'
> anywhere: to help the programmer understand how this particular code
> works.

Interface rules over implementation. Implementation can create a const local variable that is a copy of the argument, if it really wants to, though I don't like marking any local variable "const" at all. If a local variable is in use for such a large extent of code that it is in danger of being accidentally modified, then the code is too long.

I'm off cycling now; will argue^H^H^H^H^Hdebate more fully later if required.

- Julian

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Oct 9 19:17:33 2003

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.