Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #20051

Re: A short-but-bizarre program that shouldn't work but does.

Message-ID <4F9D4A06.1F4@mindspring.com> (permalink)
Date 2012-04-29 10:02 -0400
From pete <pfiland@mindspring.com>
Organization PF
Newsgroups comp.lang.c
Subject Re: A short-but-bizarre program that shouldn't work but does.
References <jN-dnRcXh_z89QHSRVn_vwA@giganews.com> <4F9C7FE7.1103@mindspring.com> <NaOdndbE44DkUwHS4p2dnAA@giganews.com>

Show all headers | View raw


Robbie Hatley wrote:
> 
> Regarding "int main(int argc, char **argv, char **envp)",
> "Pete" writes:
> 
> > It's called a "Common extension".
> >
> > ISO/IEC 9899:1999 (E)
> >
> > Annex J
> > (informative)
> > Portability issues
> > 1 This annex collects some information about portability
> >    that appears in this International Standard.
> >
> > J.5 Common extensions
> >
> > J.5.1 Environment arguments
> > 1 In a hosted environment,
> >    the main function receives a third argument,
> >    char *envp[],
> >    that points to a null-terminated array of pointers to char,
> >    each of which points to a string
> >    that provides information about the environment
> >    for this execution of the program (5.1.2.2.1).
> 
> Ah-ha!  Thanks so much for the explanation.  Obviously, then,
> this program's author made use of that, and my OS (Win-XP)
> and compiler (DJGPP's port of GCC) do support that, so when
> I compile it and run it, it works as intended.  Not portable,
> but on my setup works quite well.  Could be useful for certain
> file maintenance utilities I write from time to time if they
> need to look at an environmental variable in real time.

You're welcome.

-- 
pete

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

A short-but-bizarre program that shouldn't work but does. Robbie Hatley <see.my.signature@for.my.contact.info> - 2012-04-28 14:59 -0700
  Re: A short-but-bizarre program that shouldn't work but does. Kaz Kylheku <kaz@kylheku.com> - 2012-04-28 22:58 +0000
  Re: A short-but-bizarre program that shouldn't work but does. pete <pfiland@mindspring.com> - 2012-04-28 19:40 -0400
    Re: A short-but-bizarre program that shouldn't work but does. Robbie Hatley <see.my.signature@for.my.contact.info> - 2012-04-28 22:15 -0700
      Re: A short-but-bizarre program that shouldn't work but does. Philip Lantz <prl@canterey.us> - 2012-04-29 01:13 -0700
      Re: A short-but-bizarre program that shouldn't work but does. pete <pfiland@mindspring.com> - 2012-04-29 10:02 -0400
  Re: A short-but-bizarre program that shouldn't work but does. James Kuyper <jameskuyper@verizon.net> - 2012-04-28 22:15 -0400
  Re: A short-but-bizarre program that shouldn't work but does. Keith Thompson <kst-u@mib.org> - 2012-04-28 20:18 -0700
  Re: A short-but-bizarre program that shouldn't work but does. "Heinrich Wolf" <invalid@invalid.invalid> - 2012-04-29 11:20 +0200
    Re: A short-but-bizarre program that shouldn't work but does. "Heinrich Wolf" <invalid@invalid.invalid> - 2012-04-29 11:31 +0200
    Re: A short-but-bizarre program that shouldn't work but does. "Heinrich Wolf" <invalid@invalid.invalid> - 2012-04-29 11:38 +0200
    Re: A short-but-bizarre program that shouldn't work but does. "Heinrich Wolf" <invalid@invalid.invalid> - 2012-04-29 12:26 +0200

csiph-web