Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!pilchuck!amc!jon From: jon@amc.UUCP (Jon Mandrell) Newsgroups: comp.sys.ibm.pc Subject: Re: ** Re: MSC 4.0 Large Model ** Original Posters problem solved!!! Message-ID: <513@amc.UUCP> Date: Fri, 21-Aug-87 14:56:37 EDT Article-I.D.: amc.513 Posted: Fri Aug 21 14:56:37 1987 Date-Received: Sun, 23-Aug-87 08:18:59 EDT References: <10400006@altger.UUCP> <72@cunixc.columbia.edu> <698@ucdavis.UUCP> Reply-To: jon@amc.UUCP (Jon Mandrell) Distribution: na Organization: Applied Microsystems Corp., Redmond, WA. Lines: 31 In article <698@ucdavis.UUCP> ccs016@ucdavis.UUCP (Patrick Tully) writes: >> 1) Use NULL not 0 as often as applicable. > Why?? Null is defined in stdio as 0. > NO!!!! If you use large model on a PC, you end up with the wonderful situation of having integers and pointers as a differnet size. On most compilers, it should be the following: #define NULL (char *)0 or #define NULL 0L /* I hate this one! */ If you have a routine that wants to see some arguments, one of which is a pointer: int junk(a,b,c) int a; char *b; int c; And want to pass a 0 for b, DON'T call the function with 0!!!!!! This will screw up your stack offsets. You want to call it with NULL, which is the width of a pointer (large and small model). That is: junk(1, NULL, 2); instead of: junk(1, 0, 2); -------------------- -- Jon Mandrell, Applied Microsystems Corp., (ihnp4!uw-beaver!tikal!amc!jon) Jung vs Ze G. jrer tnl? Jbhyqa'g "Gur N Grnz" gnxr ba n jubyr qvssrerag zrnavat?