26 Jan
2006
26 Jan
'06
9:54 a.m.
Merrill Cornish wrote:
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.
I'm guessing program_options is therefore tacitly assuming the second argument is non-const also.
Simply, the standard says second argument of main is non-const. Using const version is strictly speaking, invalid, and in practice I recall there were some problems making both consts and non-const to work. - Volodya