Path: utzoo!attcan!uunet!husc6!uwvax!vanvleck!uwmcsd1!ig!agate!ucbvax!decwrl!labrea!denali!karish
From: karish@denali.stanford.edu (Chuck Karish)
Newsgroups: comp.lang.c
Subject: Re: Let's define our own NULL II
Message-ID: <22900@labrea.Stanford.EDU>
Date: 24 Jun 88 16:35:03 GMT
References: <162@navtech.uucp> <6821@sigi.Colorado.EDU>
Sender: news@labrea.Stanford.EDU
Reply-To: karish@denali.stanford.edu (Chuck Karish)
Organization: Mindcraft, Inc.
Lines: 27

In article <6821@sigi.Colorado.EDU> swarbric@tramp.Colorado.EDU (Frank Swarbrick) writes:
>Someone already pointed out that ANSI has NULL defined in stddef.h.  In Turbo C
>1.5 it is in both stdio.h and stddef.h.  If I only need NULL I just include
>stddef.h.  All that Turbo C's stddef does is typedefs size_t and ptrdiff_t,
>defines NULL (as 0 or 0L, depending on memory model) and declares errno as an
>external variable.

	ANSI C requires that compilers allow headers to be #included
	more than once, with the same result that would have been
	produced by doing it once.  Thus,  can #include 
	without worrying about whether the programmer uses that header
	a second time.

	This doesn't work in all historical implementations.  For example,
	the IBM XENIX compiler complains about multiple definitions.
	In addition, that system defined NULL to be (char *)0 (it doesn't
	have void pointers).  Lint and cc complain if 0 is used for NULL;
	I think they say "illegal combination of pointer and integer"
	for some reasonable constructs.

	The pickiness of the XENIX compiler is often helpful.  Programs
	that run on it are usually very portable to other System V
	environments.
Chuck Karish	ARPA:	karish@denali.stanford.edu
		BITNET:	karish%denali@forsythe.stanford.edu
		UUCP:	{decvax,hplabs!hpda}!mindcrf!karish
		USPS:	1825 California St. #5   Mountain View, CA 94041