"Jose Armando Garcia" <[email protected]> wrote in message news:[email protected]... > On Fri, Sep 30, 2011 at 11:27 AM, Nick Sabalausky <[email protected]> wrote: >> "Jose Armando Garcia" <[email protected]> wrote in message >> Are you serious? Don't allow it? Why? What benefit could that possibly >> provide? It makes perfect sence to think that there may be legitimate >> reason >> to use a commandline parser on something other than the current process's >> cmd args. Unittesting, for one, just off the top of my head. Other people >> here have mentioned other uses. > > You can easily unittest my suggestion. Just implement it internally > using struct/encapsulation etc but don't expose it. > > A large part of an API is about restricting people's option by solving > a set of use cases. No technology/API is the correct fit for every > problem. If you want to parse command lines use getopt. If you want to > parse config files use YAML, XML, etc. > > You don't want to arbitrarily prevent the user from doing something > but you want to limit the user's possibility to shoot themselves on > the foot! >
Parsing cmd line arguments that didn't come directly from the unmodified args passed into main is hardly shooting one's self in the foot.
