Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!auspex!guy From: guy@auspex.UUCP (Guy Harris) Newsgroups: comp.unix.wizards Subject: Re: Why isn't argv[argc]==(char *)0 ? Keywords: X/OS, Olivetti, LSX, coredump Message-ID: <2738@auspex.UUCP> Date: 19 Dec 89 00:17:04 GMT References: <547.nlhp3@oracle.nl> <1989Nov16.012439.6405@virtech.uucp> <2673@auspex.auspex.com> <8@olsa99.UUCP> Reply-To: guy@auspex.auspex.com (Guy Harris) Organization: Auspex Systems, Santa Clara Lines: 36 >OK Guys - I am the support person for Olivetti Africa and was a little >upset about the accusation. You mean the accusation that >Pim >>In X/OS, a SYSV/BSD hybrid operating system for the Olivetti LSX >Pim >>minicomputers, a reference to argv[argc] will make your program >Pim >>dump core. ? Said accusation was either incorrect or poorly stated; as indicated in my article, it could either mean "a dereference of 'argv[argc]'" will make your program drop core" (not proved true or false by your example program - see below - and if it's true, that's perfectly legitimate) or "even trying to use the pointer value 'argv[argc]' will cause your program to drop core" (proven false by your example, which is fortunate, since if it *were* true, it *would* have been a Mutant UNIX From Hell). >printf("Value of av[ac] = %s\n",av[ac]); "printf" implementations often check for null pointer values passed to "%s", and print "(null)" when a null pointer is used; if you want to see whether dereferencing a null pointer on your machine causes a core dump (if it does, 10,000 cheers for Olivetti; disallowing dereferencing of null pointers will catch annoying bugs), do: #include int main(av, ac) int av; char **ac; { if (av[ac][0] == 'z') (void) printf("Oh well, it lets me dereference null\n"); return 0; }