Re: main(int argc, char *argv[])
- From: "David Resnick" <lndresnick@xxxxxxxxx>
- Date: 29 Apr 2005 13:39:14 -0700
Michael Mair wrote:
> David Resnick wrote:
> > Recursively calling main is a bit funky. Why not have main call
some
> > other
> > function (which takes no arguments) which is then used for the
> > recursion?
> >
> > Anyway, you could always call main later with main(0,NULL).
> > Or if you want, you could squirrel away (in a static) the original
> > argc and argv and reinvoke main with them later.
>
> Not exactly. argv[argc] must be NULL, i.e. you need
> main(0, p), where *p==NULL.
>
> Cheers
> Michael
> --
> E-Mail: Mine is an /at/ gmx /dot/ de address.
Um, why? I agree with what you say when main is originally invoked by
the implementation. If invoked recursively and one no longer cares
about using argc or argv why is main(0,NULL) not acceptable? In fact,
if one is recursively invoking main (probably a bad idea), having argv
be NULL seems
like one reasonable way to indicate this is not the original
invocation.
-David
.
- Follow-Ups:
- Re: main(int argc, char *argv[])
- From: Michael Mair
- Re: main(int argc, char *argv[])
- References:
- main(int argc, char *argv[])
- From: Sokar
- Re: main(int argc, char *argv[])
- From: David Resnick
- Re: main(int argc, char *argv[])
- From: Michael Mair
- main(int argc, char *argv[])
- Prev by Date: Re: main(int argc, char *argv[])
- Next by Date: Re: main(int argc, char *argv[])
- Previous by thread: Re: main(int argc, char *argv[])
- Next by thread: Re: main(int argc, char *argv[])
- Index(es):
Relevant Pages
|