Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/5/84; site bunker.UUCP Path: utzoo!watmath!clyde!cbosgd!cbdkc1!desoto!packard!hoxna!houxm!whuxlm!akgua!sdcsvax!dcdwest!ittvax!bunker!garys From: garys@bunker.UUCP (Gary M. Samuelson) Newsgroups: net.lang.c Subject: Re: Re: SIZEOF Message-ID: <713@bunker.UUCP> Date: Fri, 8-Feb-85 09:32:44 EST Article-I.D.: bunker.713 Posted: Fri Feb 8 09:32:44 1985 Date-Received: Sun, 10-Feb-85 06:35:02 EST References: <347@ecr.UUCP> <393@rlgvax.UUCP> <808@sjuvax.UUCP> Organization: Bunker Ramo, Trumbull Ct Lines: 31 > On the topic of sizeof(int) == sizeof(int *), I refer you to K&R p. > 210, which says: > > 1. A pointer may be converted to any of the integral types > long enough to hold it. Whether an int or a long is required > is machine dependent. > > 2. An object of integral type may be explicitly converted to a > pointer... > > Since compilers need to do type checking anyway, passing 0 instead of NULL > should always be valid. Note that K&R says that assigning 0 to an integer > generates the appropriate NULL pointer. This type conversion (it is > implied) is automagic, and thus there *is* a generic NULL, which is the > integer 0. Your reasoning breaks down at the implicit assumption that passing 0 as an argument to a function constitutes an assignment. It doesn't; the compiler does not know the types of function arguments where the function is called. E.g., when you write foo(bar), the compiler knows what "bar" is, but has no idea what type foo's formal parameter has. > It is also mentioned that "The mapping function... is intended to be > unsurprising to those who know the addressing structure of the machine," > which is a loophole big enough to fly a barn through. > Jon Shapiro > Haverford College Gary Samuelson