Message from discussion
Microport Unix -- Large Model Problems
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!seismo!ll-xn!mit-eddie!husc6!wjh12!maynard!campbell
From: campb...@maynard.UUCP (Larry Campbell)
Newsgroups: net.unix-wizards
Subject: Re: Microport Unix -- Large Model Problems
Message-ID: <405@maynard.UUCP>
Date: Mon, 3-Nov-86 17:27:00 EST
Article-I.D.: maynard.405
Posted: Mon Nov 3 17:27:00 1986
Date-Received: Tue, 4-Nov-86 02:46:15 EST
References: <188@vsedev.VSE.COM> <401@maynard.UUCP> <245@rabbit1.UUCP> <347@prairie.UUCP>
Reply-To: campb...@maynard.UUCP (Larry Campbell)
Distribution: net
Organization: The Boston Software Works Inc., Maynard, MA
Lines: 19
Keywords: Microport, Unix, Memory, Segmentation, lint
In article <3...@prairie.UUCP> d...@prairie.UUCP (Daniel M. Frank) writes:
>In article <2...@rabbit1.UUCP> bar...@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.
--
Larry Campbell MCI: LCAMPBELL The Boston Software Works, Inc.
UUCP: {alliant,wjh12}!maynard!campbell 120 Fulton Street, Boston MA 02109
ARPA: campbell%maynard.u...@harvisr.harvard.edu (617) 367-6846