Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!cuae2!ihnp4!gargoyle!sphinx!wmam From: wmam@sphinx.UChicago.UUCP (tony mason) Newsgroups: net.unix-wizards Subject: Re: Microport Unix -- Large Model Problems Message-ID: <775@sphinx.UChicago.UUCP> Date: Wed, 5-Nov-86 21:49:53 EST Article-I.D.: sphinx.775 Posted: Wed Nov 5 21:49:53 1986 Date-Received: Fri, 7-Nov-86 22:41:58 EST References: <188@vsedev.VSE.COM> <401@maynard.UUCP> <245@rabbit1.UUCP> <347@prairie.UUCP> <405@maynard.UUCP> Reply-To: wmam@sphinx.UUCP (tony mason) Distribution: net Organization: Univ. of Chicago Computation Center Lines: 38 Keywords: Microport, Unix, Memory, Segmentation, lint In article <405@maynard.UUCP> campbell@maynard.UUCP (Larry Campbell) writes: >In article <347@prairie.UUCP> dan@prairie.UUCP (Daniel M. Frank) writes: >>In article <245@rabbit1.UUCP> barber@rabbit1.UUCP (Steve Barber) writes: >>>Another common problem is passing NULL as pointer argument. NULL is >>>#defined as 0, which is 2 bytes. Large model pointers are 4 bytes, so >>>the stack frame is now basically garbage. >> >> This isn't really true. Code in stdio.h for the SV/286 release >>checks your memory model, and if it is large, defines NULL to be 0L, >>which is the same size as a pointer. It doesn't please lint, so the >>best solution is still to cast it as appropriate (like (char *)0), >>but you ARE generally safe, as long as you include stdio.h. > >I wonder why stdio.h doesn't just declare NULL as "(char *) 0", or, >in the brave new world of ANSI X-whatever, "(void *) 0"? This should >do all the right things. Note that in SCO XENIX (a/k/a MICROSOFT XENIX) they have declared NULL to be of type (char *)0. Of course, you always have someone who will abuse this by doing something stupid such as: char buf[10]; buf[0] = NULL; but they will learn! The best practice is to cast it correctly (it sure makes lint happy!). Tony Mason > No opinions expressed here. Only cold hard University of Chicago > facts. uucp: ...ihnp4!gargoyle!sphinx!wmam, ...ihnp4!gargoyle!euler!tony bitnet: wmam%sphinx@UChicago.Bitnet US. Lotto System (bet your 22 cents that it will get there!!!) 3854 S. Archer (312) 254-2114 home Chicago, IL 60632