httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Trawick <>
Subject Re: cvs commit: apache-2.0/src/lib/apr/misc/unix getopt.c
Date Wed, 09 Aug 2000 20:20:25 GMT
"William A. Rowe, Jr." <> writes:

> I guess the question is, are command line arguments mutable?

I think the answer is no, but that the follow-up question is more
interesting: "can we express and enforce this immutability via the C
language without it hindering the caller?"  I think the answer to this
one may be no as well. 

> If so, all the constness is mute.  If not, it may not be convienient,
> but the types should hold up (note - const'ness is one of my several
> weak points, should go back and read my K&R again, but constness of
> type** always gives me a headache.)

The headache comes from the language I'm afraid.

> My problem, I can't get MSVC to complain (even at max error level 
> rejection), so I don't know when/if I've licked the problem.  Jeff, 
> if you have a fix, please apply and make the doc consistant.

I suspect that the "fix" is to avoid the const on the last parm to both
apr_getopt() and apr_initopt().

I realize that this is ugly in the const-ness sense, but IMHO if the
normal declaration of argv ("char **argv" or "char *argv[]") can't be passed
to apr_initopt() then it is apr_initopt() that is broken.

> This might be the fix, again I can't be certain:
>  * @deffunc apr_status_t apr_getopt(apr_getopt_t *os, const char *opts, char *optch,
const char **optarg)
>  */
> APR_EXPORT(apr_status_t) apr_getopt(apr_getopt_t *os, const char *opts, 
>                                     char *optch, const char
>  **optarg);

No...  Then I have to specify "const char *optarg" in ab.c and then I
have to cast optarg later when passing it to other routines.

(Don't forget the "problem" with apr_initopt().)

Jeff Trawick | | PGP public key at web site:
          Born in Roswell... married an alien...

View raw message