+1. That has been exactly my motivation for requiring access to the command line outside of main(); particularly for crashes that occur in global constructors before main() executes or in third party components that don't have an interface for the command line to be passed to. The command line is already exposed by implementations in practice; just not in a convenient or portable form.Not really.Some applications do want full observability of the environment, not isolation. And some application with nested components do benefit from curating input arguments, either changing directly argv to achieve this result is a good design (I would say no) it's a different matter.I for example, like to have access to argv and argc in crash traces, for the purposes of diagnostics, and this happens without any relationship to main or it's signature.
Correct.
What I think people are overlooking in this discussion is the accuracy of the information, which I think is far more important. When applications spawn other applications and make arguments available to child applications, there are specific Operating System mechanisms to achieve this result, and these mechanisms are not portable, they are not even compatible.
It's not about preventing "new and innovative ways" to write code. It's about not providing a feature that it's inaccurate, misleading, and originates from a user's misunderstanding of what this data is, where it comes from and how to manage it correctly. Which is a solved problem, just not a portable one.
Right. But a portable interface enables portable code that behaves correctly for a subset of all possible inputs for a particular operating system.
For example, it isn't a bad thing that POSIX defines a Portable
Character Set. Portable programs may have more stringent
constraints on their usage then programs purposefully built for a
particular environment.
Tom.