help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: history of argv (was: Re: How to do a massive unfill paragraph opera


From: James K. Lowden
Subject: Re: history of argv (was: Re: How to do a massive unfill paragraph operation over several hundred files?)
Date: Sat, 29 Sep 2018 17:20:00 -0400

On Sat, 29 Sep 2018 14:04:36 +0200
Emanuel Berg <moasen@zoho.com> wrote:

> BTW I always thought, without thinking about
> it, that "argv" is a convention in and from the
> C programming language!
> ...
> Or argv may trace its origin to yet some other
> language or piece of technology!

It's a little difficult to disentangle C from Unix, but the argv
convention owes more to Unix than to C.  

ISO C distinguishes between freestanding and hosted environments.  
main()  is defined only in a hosted environment, and the names of the
arguments are not defined.  So, fair to say, argv is a C convention but
not defined by C.  

Unix on the other hand defines its exec(3) family of functions.  Any
program thus invoked is provided an array of pointer-to-char and the
length of that array.  The documentation for exec(3) typically refers
to the array as argv.  

It's hard to overstate the effect Unix had on other operating systems
and programmer expectations.  Would MS-DOS or even VMS support argv, but
for the influence of Unix?  Not C, certainly; C didn't dominate the
landscape in 1980 as it does now.  That was the era of ADA,
Modula-2, Turbo-Pascal, and "4th generation" languages.  And Cobol, of
course.  

C is the native API for Windows, but the Windows entry point
(conventionally, "WinMain") isn't provided with argv.  It's given the
command line verbatim; parse it as you will.
https://msdn.microsoft.com/en-us/library/windows/desktop/ms633559
(v=vs.85).aspx

No landscape is more alien to C than IBM, and argv on IBM systems is
round peg in a square hole.  Cf. IMS and CICS at:

https://www.ibm.com/support/knowledgecenter/en/SSLTBW_2.3.0/com.ibm.zos.v2r3.cbclx01/comlin.htm.

Coming back on topic, there's no small intersection between the Unix and
elisp communities.  When the need arose to name the array of strings
passed to the exec'd program, it's little wonder it got named "argv".  

--jkl


reply via email to

[Prev in Thread] Current Thread [Next in Thread]