Re: Two questions about main's arguments
- From: raltbos@xxxxxxxxx (Richard Bos)
- Date: Sat, 12 Jun 2010 22:22:36 GMT
Denis McMahon <denis.m.f.mcmahon@xxxxxxxxxxxxxxxx> wrote:
On 09/06/10 23:57, Seebs wrote:
This question depends a whole lot on the compiler you're using.
I think it's got nothing to do with the compiler, and everything to do
with how the cli or gui concerned prepares the parameters it invoking
main with.
Surprisingly (well, it surprised me), this is indeed the case. Under old
command.coms (it's obviously a M$ CLI the OP is using), the CLI did no
argument massaging at all. Various implementations would do (or not do,
or only do if you linked certain non-Standard libs) different kinds of
argument processing.
Under Windows (at least under XP, which is what I tested it under), both
cmd.exe and command.com do _some_ argument processing, including the
behaviour the OP noted. Still no globbing, though. A quick test compiled
with two different Windows implementations and one M$-DOS one shows that
one of the former does globbing of its own, but neither CLI does.
The most surprising thing about this, IMO, is that even command.com has
been changed from its old behaviour. I'd have expected cmd.exe to have
the new behaviour, and command.com to have kept the old.
Of course, as has already been noted, according to the Standard this is
all perfectly OK. In fact, it serves as a good example of why the
Standard couldn't reasonably specify argument processing any more
precisely: if even CLIs from the same vendor, and implementations
running under the same OS, can vary like this, how can you mandate any
specific behaviour?
Richard
.
- References:
- Two questions about main's arguments
- From: DSF
- Re: Two questions about main's arguments
- From: Seebs
- Re: Two questions about main's arguments
- From: Denis McMahon
- Two questions about main's arguments
- Prev by Date: Re: Two questions about main's arguments
- Next by Date: Re: Macro that does printf and flushes.
- Previous by thread: Re: Two questions about main's arguments
- Next by thread: Re: Two questions about main's arguments
- Index(es):
Relevant Pages
|