Why isn't argv[argc]==(char *)0 ?

Guy Harris guy at auspex.auspex.com
Tue Nov 28 10:32:18 AEST 1989


>>(I.e., unless you have to deal with an archaic UNIX or a Mutant UNIX
>>From Hell, you can count on argv[argc] == 0.)
>
>In X/OS, a SYSV/BSD hybrid operating system for the Olivetti LSX
>minicomputers, a reference to argv[argc] will make your program dump core.

If you mean "a *de*reference *of* 'argv[argc]' will make your program
dump core", that's true on Suns as well, and some other machines, since
they don't let you dereference null pointers.

If you mean "even trying to copy the (pointer) *value* somewhere else
causes a core dump", then I think the label "Mutant UNIX From Hell" is
well-deserved; I've nothing against, say, array bounds-checking, but
"argv" has "argc+1" elements, not "argc" elements - if Olivetti intends
to get POSIX or ANSI C support on the LSX, they'd better fix this....



More information about the Comp.unix.wizards mailing list