Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 (Tek) 9/28/84 based on 9/17/84; site tekigm.UUCP Path: utzoo!watmath!clyde!cbosgd!ihnp4!houxm!vax135!cornell!uw-beaver!tektronix!tekigm!jonk From: jonk@tekigm.UUCP (Jonathan W. Krueger) Newsgroups: net.unix-wizards Subject: Re: Xenix286 Wonders, Bugs, and Patches... Message-ID: <334@tekigm.UUCP> Date: Tue, 14-May-85 15:52:09 EDT Article-I.D.: tekigm.334 Posted: Tue May 14 15:52:09 1985 Date-Received: Fri, 17-May-85 00:03:54 EDT References: <10550@brl-tgr.ARPA> Reply-To: jonk@tekigm.UUCP (Jonathan W. Krueger) Organization: Tektronix, Beaverton OR Lines: 32 '#define'ing NULL to be simply 0 (zero) can and will screw up C programs on the '286 (or '86) which make the assumption that sizeof(int) == sizeof(int *). The following exemplefies this: baz() { ... foo( NULL, more_args_of_various_sizes, ... ); ... } foo( p, more_params_of_various_sizes, ... ); struct whatever *p; typeof more_para....; { if ( p == NULL ) /* then */ { ... } ... } The Xenix '286 C compiler generates the call to foo with an "int" 0 (2 bytes), not a "long" 0 (4 bytes). foo expects 4 bytes in that position. This is partly why on Xenix-286 you find three (or more) packagings of the standard C library: one for each compiler memory model, small, medium and large. Another reason is that larger programs need to use "far jumps" rather than "near jumps." Of course, I trust you to tell me if I'm wrong. -- Humbly, Jonathan W. Krueger ...ihnp4!tektronix!tekigm!jonk "To change my opinion, you must first change my reality."