Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!rutgers!labrea!aurora!ames!sdcsvax!ucsdhub!hp-sdd!ncr-sd!crash!gof From: gof@crash.CTS.COM (Jerry Fountain) Newsgroups: comp.sys.ibm.pc Subject: Re: ** Re: MSC 4.0 Large Model ** NULL isn't always 0 Message-ID: <1591@crash.CTS.COM> Date: Sun, 23-Aug-87 15:12:47 EDT Article-I.D.: crash.1591 Posted: Sun Aug 23 15:12:47 1987 Date-Received: Mon, 24-Aug-87 03:46:13 EDT Reply-To: gof@crash.CTS.COM (Jerry Fountain) Organization: Crash TS, El Cajon, CA Lines: 28 Keywords: Solution In article <158@dolphy.UUCP> jmg@dolphy.UUCP (Jeffrey Greenberg) writes: > >You SHOULD use NULL instead of 0 or 0L etc. because things like > char *x; > x = (char *) NULL; >does not mean that the address that x is pointing to is address 0. >It is not true on all machines... Any code you write like this >won't run on a Sun machines to name one. This is a machine/OS dependency. >If you do things like, I think a nice elegant solution might be to just edit your *.h file and insert the following: #define NULL (char *) 0 *IF* your system defines NULL to 0. Otherwise use whatever your system requires. This has 2 benefits. 1) MS-DOS systems will convert the pointer to the required type (near or far) AUTOMATICALLY (although mixed model will choke at times, but that is a special case). 2) Lazy programmers (perhaps a bad description) will be protected from forgetting (or just not typing) the pointer declaration that NULL needs now. Perhaps I am crazy but this seems to be a *very* workable solution. -- -----Jerry Fountain----- UUCP: {hplabs!hp-sdd,sdcsvax,nosc}!crash!pnet01!gof ARPA: crash!gof@nosc.mil MAIL: 523 Glen Oaks Dr., Alpine, Calif. 92001 INET: gof@pnet01.CTS.COM