Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!mimsy!umd5!brl-adm!brl-smoke!gwyn From: gwyn@brl-smoke.ARPA (Doug Gwyn ) Newsgroups: comp.lang.c Subject: Re: Writing readable code Message-ID: <6062@brl-smoke.ARPA> Date: Sun, 5-Jul-87 16:53:22 EDT Article-I.D.: brl-smok.6062 Posted: Sun Jul 5 16:53:22 1987 Date-Received: Sun, 5-Jul-87 22:48:26 EDT References: <1158@copper.TEK.COM> <6858@auspyr.UUCP> Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB)) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 25 In article <13148@topaz.rutgers.edu> ron@topaz.rutgers.edu (Ron Natalie) writes: >Microsoft C (if it really requires NULL to be 0L) is broken ... True, but I doubt that the "large model" MicroSoft C REALLY "requires" that definition. I suspect it was intended to make sloppy code such as func( 1.0, NULL, &a ); "work" even though such code is simply non-portable NO MATTER WHAT rules one tries to impose on the definition for "NULL". (For people who STILL don't understand this, consider that sizeof(char *) need not be the same as sizeof(int *), so the correct size for the second parameter to func() depends on the particular pointer type that func() expects; there is NO universal pointer size in such an implementation.) Personally I would rather see the code BREAK, so that the programmer would LEARN how to code portably and FIX the code for once and for all. (This is the same reason that I chose to make "ordinary" chars unsigned on my Gould implementation of the System V implementation (as opposed to signed on my VAX implementation), even though the native Gould compiler made them signed, presumably to help prop up buggy code from VAX 4.nBSD. I have seen a lot of 3Bx AT&T code assume that chars are unsigned, which is just the opposite bug.) We occasionally hear (in this and the UNIX newsgroups) marketing "justifications" for adapting implementations to certain erroneous coding practices, but the customer is NOT "always right"! In fact, when I evaluate a system I would give NEGATIVE scoring points to those vendors who deliberately pander to such errors.