Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!sri-spam!sri-unix!hplabs!pyramid!amdahl!oliveb!sun!guy From: guy@sun.uucp (Guy Harris) Newsgroups: net.unix-wizards Subject: Re: Microport Unix -- Large Model Problems Message-ID: <8835@sun.uucp> Date: Mon, 3-Nov-86 05:52:16 EST Article-I.D.: sun.8835 Posted: Mon Nov 3 05:52:16 1986 Date-Received: Tue, 4-Nov-86 05:23:43 EST References: <188@vsedev.VSE.COM> <401@maynard.UUCP> <245@rabbit1.UUCP> Distribution: net Organization: Sun Microsystems, Inc. Lines: 24 > Another common problem is passing NULL as pointer argument. NULL is > #defined as 0, which is 2 bytes. Large model pointers are 4 bytes, so > the stack frame is now basically garbage. The solution is to cast the > NULLs to the appropriate types. Ahhh..Intel..you can never be forgiven > for making us have to worry about memory models... Yes, having to worry about memory models may be a pain; however, even if you didn't have multiple memory models, you'd *still* have to worry about properly declaring pointer-valued functions and casting null pointers. A 68K implementation might have 16-bit "int"s and 32-bit pointers, or might return the value of an integral-type-valued function in D0 and the value of a pointer-valued function in A0. Other implementations might not use an all-zero bit pattern to represent a null pointer. I really hope that when the ANSI C standard comes out, compilers start issuing warnings if you use a function that you haven't already declared, or if you don't declare the types of the arguments to a function. Yes, this may inconvenience programmers, but the ones it most inconveniences are the ones who just don't *care* about data types, and they're the ones who need the biggest attitude adjustment. -- Guy Harris {ihnp4, decvax, seismo, decwrl, ...}!sun!guy guy@sun.com (or guy@sun.arpa)