use of NULL

Wayne A. Throop throopw at xyzzy.UUCP
Sat Feb 25 06:46:48 AEST 1989


> cramer at optilink.UUCP (Clayton Cramer)
> But the use of NULL when that's what
> you mean will save someone some headaches when it comes time to
> port a program to a segmented arguments.

Not so.  Because using uncast NULL as an actual argument for
a formal argument of pointer type with no prototype in scope
IS NEVER WHAT YOU MEAN.  PERIOD.

It is simply not portable to do this.  The C lanuage as defined by
K&R or (proposed) by ANSI does not guarantee the behavior if this is
done.

> Not true.  In large model, stdio.h defines NULL to be 0L.  NULL requires
> no casting to work correctly with the Microsoft C compiler.

In some models, sometimes.  But in general, the usage is not portable
to all memory models on this one compiler, and certainly not portable
to all compilers.  It is unsupported by any language standard (as
opposed to partially supported by a language implementation).

--
All things sick and cancerous,
All evil great ans small,
All things foul and dangerous,
The Lord God made them all.
          --- Monty Python
-- 
Wayne Throop      <the-known-world>!mcnc!rti!xyzzy!throopw



More information about the Comp.lang.c mailing list