Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!uunet!auspex!guy From: guy@auspex.auspex.com (Guy Harris) Newsgroups: comp.lang.c Subject: Re: When it is amoral... (Re: When is a cast not a cast?) Message-ID: <1566@auspex.auspex.com> Date: 5 May 89 07:24:57 GMT References: <2747@buengc.BU.EDU> <2763@buengc.BU.EDU> <1558@auspex.auspex.com> <2765@buengc.BU.EDU> Reply-To: guy@auspex.auspex.com (Guy Harris) Organization: Auspex Systems, Santa Clara Lines: 25 >Normal C, however, allows this sort of thing by telling one to declare > > int diffa; > >and merrily arithmeticise. No warnings, no complaints, not even a bump >in the great, grassy field of complacen-C.... Or, even better, "ptrdiff_t diffa", in (p)ANS C at least, where "ptrdiff_t" is defined in . >Mind you, it's real nice to be able to do it this way, and if one >couldn't, we'd all be screaming for it, but it feels the same as adding >shorts, longs, and ints together haphazardly. Well, think of "ptrdiff_t" as syntactic sugar-coating, or syntactic buffering to prevent an upset stomach (you remember, the little "B"s bouncing around your stomach, which don't have the sharp points that the little "A"s do, and thus don't poke into your stomach lining); you now have objects of various flavors of pointer type, of various flavors of integral type - and of a type that means "difference between pointers", although that type happens to be one of the integral types. Now, while pointers come in different types, "difference between pointers" happens to come in only one type - but then, measurements come in different types (cm, inches, grams, furlongs, fortnights, etc.), but ratios of measurements come in one type, too....