|
Boost Users : |
From: Pedro Lamarão (pedro.lamarao_at_[hidden])
Date: 2006-01-26 13:08:28
Merrill Cornish escreveu:
> Steve,
>
> I ran into the same problem. Once I thought about it, I realized
> I had _never_ seen a C or C++ main() function prototype defined
> with a const second argument.
>
> I think I remember that one of the traditional C getopt() function
> variants actually munges the argument list by removing that
> arguments it recognizes, leaving anything else for direct processing
> by the program.
This is still possible if the type of the second argument is
char const* argv[] as shown by the following code:
char const* args[] = { "zero", "one" };
std::swap(args[0], args[1]);
std::cout << args[0] << std::endl;
std::cout << args[1] << std::endl;
It wouldn't hurt if parse_command_line and friends had a const there, if
they don't change the strings by design.
-- Pedro Lamarão Desenvolvimento Intersix Technologies S.A. SP: (55 11 3803-9300) RJ: (55 21 3852-3240) www.intersix.com.br Your Security is our Business
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net