Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!dayton!ems!rosevax!sds!dave From: dave@sds.SciCom.MN.ORG (dave schmidt x194) Newsgroups: comp.lang.c Subject: Re: Writing readable code Message-ID: <423@sds.SciCom.MN.ORG> Date: Tue, 7-Jul-87 10:53:13 EDT Article-I.D.: sds.423 Posted: Tue Jul 7 10:53:13 1987 Date-Received: Sat, 11-Jul-87 00:45:16 EDT References: <1158@copper.TEK.COM> <6858@auspyr.UUCP> <17171@cca.CCA.COM> <22766@sun.uucp> Organization: SciCom Data Services Ltd., Minnetonka, MN Lines: 57 > > I don't know, I think this is defensible. The reason that Microsoft did > > this was so that UNIXisms like: > > > > execl(a, b, c, NULL); > > > > Continue to work even on the bizzare 8086 architecture. > > 1) This is NOT a "UNIXism". There are UNIX implementations on which this > does NOT work. Absolutely true. However, looking through my MicroSoft Xenix manual, I can find correct synopses such as int execl( path, arg0, arg1, ..., argN, (char *)0 ) char *path, *arg0, *arg1, ..., *argN; and int wait(stat_loc) int *stat_loc; int wait((int *)0) but I can also find incorrect (or at least misleading) statements such as char *strtok(s1, s2) char *s1, *s2; the description for strtok() states: "... Subsequent calls with NULL for the first argument ..." and char *defread(pattern) char *pattern; the description for defread() states: "... or it [the program] may call defopen with NULL, ..." which certainly implies that strtok(NULL, s2) and defread(NULL) are valid calls. Hopefully, the misleading implications above are peculiar to the MS manuals and are not indicative of what the System V or BSD manuals say. If, however, other manuals mislead the reader in this manner, then it is small wonder that people (a) don't cast NULL when passing it as an argument to functions, (b) regard things such as execl(a,b,c,NULL) as an "UNIXism", (c) think (as I used to, before my enlightenment :-) that #define-ing NULL as something other than 0 (like (char *)0) is correct, since if it were otherwise one couldn't write defread(NULL) which the manual says is OK. Anyway, how about this: if your reference manuals seem to imply that passing NULL to a function without a cast is an OK thing to do, drop me an e-mail message and I'll summarize to the net later if there is sufficient response. Dave Schmidt {cbosgd, ihnp4, rutgers}!meccts!sds!dave