Xref: utzoo comp.lang.c:6647 comp.sys.m68k:680 Path: utzoo!utgpu!water!watmath!clyde!rutgers!cmcl2!phri!cooper!gene From: gene@cooper.cooper.EDU (Gene (the Spook)) Newsgroups: comp.lang.c,comp.sys.m68k Subject: Re: C machine Message-ID: <1186@cooper.cooper.EDU> Date: 22 Jan 88 23:48:30 GMT References: <7092@brl-smoke.ARPA> Organization: The Cooper Union (NY, NY) Lines: 43 in article <7092@brl-smoke.ARPA>, gwyn@brl-smoke.ARPA (Doug Gwyn ) says: > > In article <39aca826.7f32@apollo.uucp> johnf@apollo.uucp (John Francis) writes: >>The result of subtracting two pointers is *defined* (K&R) to yield >>a result of type int. > That's another of the things that ANSI C intends to fix. "Fix"? "FIX"???? Please! ANSI's done enough already. Why don't they just leave it alone? After all, what else would it be? Take the example of an offset from a pointer. If, for example, you have p1 = p0[d] This would be interpreted as (ptr) p1 = (ptr) p0 + (int) d Simply, add an integer displacement to a pointer, and you'll get another pointer. With a little algebra, solve for 'd'. You'll get (int) d = (ptr) p1 - (ptr) p0 This is simply solving for the displacement. What else could it be??? I think the K&R solution is just fine the way it is. How in the world could ANSI "fix" it? Can someone please explain that to me? Really, I would appreciate an email'ed response, since I don't often get to read the news. Thanx in advance. Spookfully yours, Gene ...!ihnp4!philabs!phri!cooper!gene "If you think I'll sit around as the world goes by, You're thinkin' like a fool 'cause it's case of do or die. Out there is a fortune waitin' to be had. You think I'll let it go? You're mad! You got another thing comin'!" - Robert John Aurthur Halford