What is NULL? (argument passong on evil machines)

Bill.Stewart wcs at ho95e.ATT.COM
Fri Feb 26 09:25:54 AEST 1988


In article <3458 at killer.UUCP> richardh at killer.UUCP (Richard Hargrove) writes:
>	[ discussion by various people about NULL - the usual stuff ]
>The definition of NULL as 0L by C compilers targeted to the 80x86 is a
>kludge attempting to protect ignorant C programmers who don't cast
>NULL (which, to the compiler is indistinguishable from 0) when it
>is an actual parameter. 

On a normal machine, pointers are all the same size, or at least
pointers to type foo are always the same size.  But on an Intel
chip, pointers come in different sizes.  If you compile one
subroutine using one memory model (e.g. on Microslow C 5.0),
and another subroutine using another memory model, will they be
linked together properly (or at least refuse to link), or will
the compiler quietly link together routines with different-sized 
pointers from different memory models?

We've been burned in the past passing floats on a machine that used
IEEE-format (float and double look very different), where it didn't
coerce all floats to doubles when passing.  Will the popular PC
compilers get this one right also?
-- 
#				Thanks;
# Bill Stewart, AT&T Bell Labs 2G218, Holmdel NJ 1-201-949-0705 ihnp4!ho95c!wcs



More information about the Comp.unix.questions mailing list