Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!henry From: henry@utzoo.UUCP (Henry Spencer) Newsgroups: news.software.b,comp.lang.c Subject: Re: News for Xenix on PC AT ? Message-ID: <7966@utzoo.UUCP> Date: Mon, 27-Apr-87 11:30:20 EDT Article-I.D.: utzoo.7966 Posted: Mon Apr 27 11:30:20 1987 Date-Received: Mon, 27-Apr-87 11:30:20 EDT References: <18346@ucbvax.BERKELEY.EDU> Organization: U of Toronto Zoology Lines: 29 > No. On the 8086 family, in large model, if NULL is defined as 0, then > such things as > > execl(..., NULL) ; > > will fail, because a pointer (32-bit) parameter is expected... Quite true, because the code is incorrect. The correct way to write this, obsolete manuals notwithstanding, is: execl(..., (char *)NULL); > It's pretty safe to define NULL as 0L when in large model, but the best > solution of all is (void *)0... In correct, portable pre-X3J11 C, THERE IS NO WAY TO AVOID THE char * CAST! The problem is that pointers of different types are not even guaranteed to have the same size, much less the same representation, so there is no, repeat *NO*, "generic NULL pointer". This doesn't matter much except at the function-call interface, since the compiler will get it right elsewhere if NULL is just 0 (and if the compiler is compiling C, not some peculiar variant of it)... but at the function-call interface it matters very much and there is simply no substitute for typing a few extra characters to get it right! It is popular to botch this. That does not make it right. -- "If you want PL/I, you know Henry Spencer @ U of Toronto Zoology where to find it." -- DMR {allegra,ihnp4,decvax,pyramid}!utzoo!henry