apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "William A. Rowe, Jr." <wr...@rowe-clan.net>
Subject RE: [PATCH] apr_getopt_long interface update and interleaving support
Date Sat, 25 Nov 2000 00:48:09 GMT
> From: Greg Hudson [mailto:ghudson@MIT.EDU]
> Sent: Friday, November 24, 2000 6:35 PM
> 
> >> -    char *const *argv;
> >> +    char **argv;
> 
> > Um. I don't think we can do this with argv. I'm surprised that it
> > isn't "const char * const * argv".
> 
> We can do whatever we want with argv.  That's pretty well-established.

Yes.  But you are making a critical flaw in your thinking :-)
You assume we are dealing with argc/argv ...

after that simmered for a second, realize other apr_getopt users will be
processing other arrays of arrays, not only the main() args.
 
> 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.

Don't be silly, you can always pass a non-const value for a const arg.
Same with silent promotions of int to long, etc.

Mime
View raw message