On Thu, 29 Sep 2011 18:41:33 +0300, Andrei Alexandrescu <[email protected]> wrote:

It would be quite abnormal to run getopt multiple times in the same app with different configurations. So in this case using globals is _better_, not worse.

How about this: your program uses a logging component. You pass the command-line arguments to the logging component, so that it uses getopt to pick out the logging options and returns the rest.

One day, the maintainers of the logging component decide to add compatibility with Brand X logging component, which uses ':' for the equal-sign separator. Naturally the maintainers are sloppy and don't restore the option after setting it. You know what happens next...

--
Best regards,
 Vladimir                            mailto:[email protected]

Reply via email to