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

Re: CVS update: subversion/subversion/client add-cmd.c checkout-cmd.c cl.h commit-cmd.c delete-cmd.c main.c propget-cmd.c proplist-cmd.c props.c propset-cmd.c status-cmd.c update-cmd.c

From: Jim Blandy <jimb_at_zwingli.cygnus.com>
Date: 2000-11-18 20:48:57 CET

> [ I've been on a mission re: const for a while. there are two reasons for
> adding const: 1) "static const" data can then be passed in functions that
> are declared with 'const' (if a function does /not/ have const, then you
> cannot pass const data to it); 2) the 'const' is a semantic signal that
> the function will not be changing your data. ]

Const is one of those things which seems like a nice idea, but the way
it actually works out is so disappointing. For example, consider:

        #include <string.h>

        char *pc;
        const char *pcc; /* assume non-empty */

        pc = strchr (pcc, pcc[0]);

Hmm. It all type-checks, but somehow I've turned a const char * into
a char *. So we've gone to all the trouble to implement this static
typechecking, which then doesn't let us express everyday arrangements.
You can't even implement something straightforward like strchr without
"turning off" your type checker on the returned value.

Not an objection to Greg's changes, just a language gripe.
Received on Sat Oct 21 14:36:15 2006

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.