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

Re: [PATCH] apr_getopt_long interface update and interleaving support

From: Karl Fogel <kfogel_at_galois.collab.net>
Date: 2000-11-25 05:48:03 CET

Greg Hudson <ghudson@MIT.EDU> writes:
> It wasn't "const char *const *argv" before because a "char **"
> argument is not compatible with such a parameter, and C programs
> canonically take "char **argv", not "const char *const *argv". I'm
> not sure if it's even valid C to silently change from char * to const
> char * without an explicit cast, which is what you'd be doing if you
> wrote a main() which accepted a list of const char pointers intead of
> a list of char pointers.
>
> (Branko said this as well, in different words.)

Just to second William Rowe's point about this, since we're trying to
use const wherever possible (in both APR and Subversion, I think):

Const is only important in lvalues. The rules are

  1. It's okay to not modify something you were allowed to modify.
  2. It's not okay to modify something you were not allowed to modify.

Const doesn't change the type (storage size) of anything. So a callee
can *always* add a const qualifier to its parameters, as long as it
then keeps that promise to never modify the data.

-K
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.