[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 00:10:08 CET

Greg Stein <gstein@lyra.org> writes:
> So... by stating the parameter is "const char * const *argv", we are saying
> what we intend to do (or not do) with the arguments. And I think we really
> ought to treat it as if those const qualifiers were on there.

I confess I don't understand the nuance of these `const' usages.

The code needs to permute argv; if it can't, we'll have to change the
interface, right? If Greg H has to cast internally to get something
he can permute, then we might as well not require a const on the
castee in the first place.

Does the above declaration still permit permutation of the array?
(Apologies; I'm rereading my K&R and still not fully understanding
what the above does.)

That is (using the invocation "svn -d foo bar"), we have

   argv --------+
                |
                |
                V
               [pointer1 , pointer2 , pointer3 , pointer4, pointer5]
                   | | | | |
                   | | | | |
                   | | | | |
                   V V V V V
                  [svn\0] [-d\0] [foo\0] [bar\0] <NULL>

So there are three things that could be constified:

   1. The variable `argv', which holds a pointer to an array of
      pointers.

   2. The elements of that array, each of which points to a C string.

   3. The elements of a given C string.

If we're constifying #2, then that's a problem for permutation.

Please feel free to bean me if I'm totally missing the point here...

Humility is my strong suit,
(Oh wait),
-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.