Path: utzoo!attcan!uunet!lll-winken!lll-tis!ames!ll-xn!mit-eddie!bu-cs!purdue!decwrl!decvax!tektronix!tekcrl!tekchips!danw From: danw@tekchips.CRL.TEK.COM (Daniel E. Wilson;1432;58-790;;) Newsgroups: comp.lang.c Subject: Re: How do a write portable programs? Message-ID: <3041@tekcrl.CRL.TEK.COM> Date: 10 Sep 88 05:57:31 GMT References: <1056@nmtsun.nmt.edu> <2515@ingr.UUCP> <7229@haddock.ima.isc.com> Sender: ftp@tekcrl.CRL.TEK.COM Lines: 18 In article <2515@ingr.UUCP> jones@ingr.UUCP (Mark Jones) writes: >In article <1056@nmtsun.nmt.edu>, warner@hydrovax.nmt.edu (M. Warner Losh) writes: >Instead of using NULL, use ZERO, and don't worry about casting it. [Because >K&R guarantees that `0' denotes a null pointer constant.] I for one have problems with this. There is an Intel C compiler that will not handle 0 for a NULL pointer in the large memory model. This is due to the lack of argument checking in K&R C. (C++ is much better.) If you wish for a program to be portable do this: #define NIL(type) ((type *) 0) Always use this function and you avoid the problem. -------------- Dan Wilson These opinions are my own. My manager would prefer that I didn't have opinions.