Re: no sys.argc

Robert Sanders (
29 Jun 1994 09:20:28 GMT

In article <> Jim Roskind <> writes:

Actually though, looking at your code fragment, I could ask why you
would write (in C):

if (1 == argc)

rather than:

if (NULL == argv[1])

That would be a silly question. For values other than one (because
argv is pretty much guaranteed to have at least one element), you'd be
in danger of pointing right past the end of argv[] and into
uninitialized (or initialized but irrelevent) gibberish. The only
proper way to roll your own argc is to walk through argv until you hit
the NULL entry; you can't just jump there. It's this kind of boring
contortion that really makes me hate C for 98% of all programming

We can assume that the original poster is new to sensible languages
like Python and that it never occurred to him that argc is redundant.
In a language whose only truly first-class types are numerics and
pointers, having someone pass you the size of an array with the array
seems perfectly reasonable.

-- Robert