Microport Unix -- Large Model Problems

Larry Campbell campbell at maynard.UUCP
Tue Nov 4 08:27:00 AEST 1986


In article <347 at prairie.UUCP> dan at prairie.UUCP (Daniel M. Frank) writes:
>In article <245 at rabbit1.UUCP> barber at 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.uucp at harvisr.harvard.edu     (617) 367-6846



More information about the Comp.unix.wizards mailing list